Do I need all database columns in my DataTable for SqlBulkCopy WriteToServer?

datatable sqlbulkcopy

Question

I'm importing some data from a CSV, and it doesn't have all the fields my table does. I was making a DataTable with only the columns of my CSV, but I'm getting errors about converting from String to Boolean. None of the fields I'm adding are Boolean, so I'm assuming its a problem with the fields I left alone.

Do I need to have a 1-1 mapping in my DataTable?

Accepted Answer

Well, once I added all the columns, things started working, so I guess the answer is yes.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow