user1590636
user1590636

Reputation: 1194

bulk copy throws an exception when there is a DateTime column

i am doing a bulk copy in c#, and its working fine except when i add a DateTime column to the DataTable the bulk copy throws an exception that The given ColumnMapping does not match up with any column in the source or destination. , when i remove the DateTime column and execute the bulk copy things work normally

is there something extra i have to do when adding a DateTime column?

Upvotes: 0

Views: 3483

Answers (2)

Smaug
Smaug

Reputation: 2673

From my experience the below are the possibilities to cause this kind of issues

  1. Column names match in source and table That the column types match

  2. Allow nulls in date\time columns in your table, then insert the null value through DataTable, If it works then the problem with data else mapping is the problem.

Upvotes: 2

AdaTheDev
AdaTheDev

Reputation: 147224

It might not be specifically due to it being a DateTime column - check your ColumnMapping names as they are case sensitive - that could be the problem.

Blogged about it here

Upvotes: 1

Related Questions