SqlBulkCopy - The given value of type String from the data source cannot be converted to type money of the specified target column

后端 未结 8 1893
慢半拍i
慢半拍i 2020-11-30 03:08

I\'m getting this exception when trying to do an SqlBulkCopy from a DataTable.

Error Message: The given value of type String from the data source cannot be c         


        
8条回答
  •  旧巷少年郎
    2020-11-30 03:21

    Not going to be everyone's fix, but it was for me:

    So, i ran across this exact issue. The problem I seemed to have was when my DataTable didnt have an ID column, but the target destination had one with a primary key.

    When i adapted my DataTable to have an id, the copy worked perfectly.

    In my scenario, the Id column isnt very important to have the primary key so i deleted this column from the target destination table and the SqlBulkCopy is working without issue.

提交回复
热议问题