Column types in a System.DataTable

  • Thread starter Thread starter Rob Panosh
  • Start date Start date
R

Rob Panosh

Hello,

How does a System.DataTable determine the datatypes of its columns when
filled using a select statement. If I fill a datatable using the sample
table/data, Select * from myTest (MSS 2K), below the test1 column is defined
as a decimal. Why wouldn't it be defined as a Int64? Or can this be
controlled?

Sample Table and Data:
================
Create Table myTest ( test1 numeric(10,0) not null )

Insert Into myTest Values ( 1, 'value 1' )
Insert Into myTest Values ( 2, 'value 2' )


Thanks,
Rob Panosh
 
Hi Rob,

It can't be controlled at runtime.
Rather, create a strongtyped dataset at design time and adjust columns if
you need to.
 
Back
Top