tags:

views:

26

answers:

2

I am reading CSV files (using .Net) into a DataTable using an OdbcConnection. One of my columns is an ID field that should be read in as strings (these values are numbers with padded zeros). When I fill the DataTable using the OdbcDataAdapter, this value gets converted to an INT rather than a string. For example, one id might be "00001" and it is being read in as "1".

Any ideas into how I can maintain the integrity of this field?

A: 

Create a strongly typed dataset and fill the dataset as opposed to the table, you can get to the underlying data table from this dataset. If you are used to using wizards, you can do Add | New Item | DataSet. Name your dataset, add a DataTable via he designer, define your columns and make use the adapter fill method to fill in this dataset.

RandomNoob
A: 

Make sure that the Schema.ini file associated with the DSN defines the correct data types. If you use the text driver's 'guessing' functionality it may guess text for things that aren't.

Erik E