Using SQLBulkCopy to Insert/Update database

前端 未结 4 1810
遥遥无期
遥遥无期 2020-12-10 14:51

I have a datatable with the records.I\'m inserting records into Sql table using SqlBulkCopy.It works fine.Next time when get the datatable with same records with few changed

4条回答
  •  抹茶落季
    2020-12-10 15:43

    SqlBulkCopy is only used for inserting records, not updating them as explained here. You'd need to use a different technique to do bulk updates.

    e.g. you could SqlBulkCopy into a staging table, then run some SQL to update from there to the main table.

提交回复
热议问题