Changing populated DataTable column data types
Posted
by TonE
on Stack Overflow
See other posts from Stack Overflow
or by TonE
Published on 2010-03-29T14:09:50Z
Indexed on
2010/03/29
14:13 UTC
Read the original article
Hit count: 129
Hi,
I have a System.Data.DataTable which is populated by reading a CSV file which sets the datatype of each column to string.
I want to append the contents of the DataTable to an existing database table - currently this is done using SqlBulkCopy with the DataTable as the source.
However, the column data types of the DataTable need to be changed to match the schema of the target database table, handling null values.
I am not very familiar with ADO.NET so have been search for a clean way of doing this?
Thanks.
© Stack Overflow or respective owner