开发者

datatable compare

开发者 https://www.devze.com 2022-12-12 19:15 出处:网络
I have a DataTable dtOld with records from database. I have a DataTable dtNew with new records to be written to the database.

I have a DataTable dtOld with records from database.

I have a DataTable dtNew with new records to be written to the database.

开发者_如何学Python

Can someone please help with the best way to send the new DataTable dtNew to the database without records that already exist in the dtOld DataTable?

thanks, rodchar


Rather than maintain two separate DataTables, it might be easier to use the technique demonstrated here:

http://msdn.microsoft.com/en-us/library/xzb1zw3x%28VS.80%29.aspx

You can use a DataAdapter to update the database with records that have a particular row state (added, for instance).

0

精彩评论

暂无评论...
验证码 换一张
取 消