Type conversion problems with ADO.NET

  • Thread starter Thread starter Michael Hodgson
  • Start date Start date
M

Michael Hodgson

Hello,

Hoping someone here can help me...

I'm trying to use a DataSet built from a number of different sources,
and build some relationships between the constituent tables.

The first table basically consists of:

CatID,Description

and the second is

CatID,TileID

The problem is that CatID in the first table is Int16 (short) and CatID
in the second table is Int32. As a result I can't create a datarelation
between the two CatID columns.

I cannot change the table definition for Table1(format is specified by
the client) to make both CatID columns Int32, and it seems you cannot
change the DataType of a column once it's loaded with data - short of
creating a new DataTable in memory with the new schema and copying the
rows across one at a time. Is there another way?

The source database for Table1 is Access 2000 and it's being accessed
via OleDB. Inside Access you can do something like:

SELECT clng(CatID), Description

but this unsuprisingly fails when called via. the OleDB provider.

I believe functions like CAST and CONVERT exist for big brother
SQL-SERVER, but I cannot come up with a syntax that seems to work for my
Access DB.

There must be a way of getting a Column of Int16 numbers from Access
into a DataTable as Int32?

-Michael
 
Hi Micheal,

Create table with right column types before you fill it and then fill it :-)
 
Back
Top