Thursday 15 April 2010

c# - SqlBulkCopy problem -


I use SqlBulkCopy to insert data from OleDbDataReader (contains data from xls) to mssql-2005 There is a client on IleDbDataReader (in Xls)

The number stored in the form of the number is included when I look at the mssql data, in that column I see nonsense all the other columns move right.

You need to map the code into columns like ... < / P>

 using  (SqlBulkCopy bulkCopy = new SqlBulkCopy (destConnection)) {bulkCopy.ColumnMappings.Add ("ID", "ID"); BulkCopy.ColumnMappings.Add ("Email", "Email"); BulkCopy.DestinationTableName = "tableName"; BulkCopy.WriteToServer (ExcelReader); }  

No comments:

Post a Comment