SqlBulkCopy Not Working

前端 未结 7 2222
予麋鹿
予麋鹿 2021-02-18 17:54

I have a DataSet populated from Excel Sheet. I wanted to use SQLBulk Copy to Insert Records in Lead_Hdr table where LeadId is PK.

7条回答
  •  一个人的身影
    2021-02-18 18:40

    The answer by Marc would be my recomendation (on using staging table). This ensures that if your source doesn't change, you'll have fewer issues importing in the future.

    However, in my experience, you can check the following issues:

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

    If you think you did this and still no success. You can try the following.

    1 - Allow nulls in all columns in your table 2 - comment out all column mappings 3 - rerun adding one column at a time until you find where your issue is

    That should bring out the bug

提交回复
热议问题