.net - C# - Does DataTable.Merge() add duplicates or update? -
i have 2 datatables. 1 current rows in table sqlserver , 1 new rows want add.
i want like:
datatable1.merge(datatable2);
i trying figure out, if duplicates between these 2 tables exist, duplicate added datatable1, or update values in datatable1?
i need duplicates updated in datatable1, , non-duplicates added datatable1.
iv searched msdn , cant find distinct answer.
from last paragraph merge documentaton
when merging new source datatable target, source rows datarowstate value of unchanged, modified, or deleted, matched target rows same primary key values. source rows datarowstate value of added matched new target rows same primary key values new source rows.
it update row has same primary key. primary key set datatable.primarykey
property
Comments
Post a Comment