I know this question has been asked multiple times and i have read them, but my question goes a bit differently.
I have 2 tables. (not sql tables, these are c# DataTables).
tab1 (the original table):
col A
col B
col C
and tab2 (copy of the original. this table's data may be modified by the user):
col A
col B
col C
what i want to do is compare tab2 to tab1 and find the diference.
but, what i want is a little more detailed:
1) Find all rows that are in tab2 but not in tab1 , ie., new rows generated by the user
and use these to preform insert on the DB.
2) Find all rows that are in tab1 but not in tab2, ie., rows that have been deleted by the user and use them to perform delete/soft delete on the DB.
3) Find all the rows excluding those selected in the above 2 steps and perform an update on the DB. here, it doesnt matter if these rows have indeed been updated. But it would be better if we could find only the updated rows...
Any ideas and help are appreciated.
Update 1:
A) The tables are C# DataTables, not sql/mysql DB tables. We find the difference in the DataTables and insert/update/delete those rows later from the DB tables. So I want to compare two c# DataTables.
B) AcceptChanges has already been called on the copy Table. This is because these tables are bound to a DataGridView. Changes in value of column A or B causes related changes in column C in case there are such related columns. For example if value of column C = column A + column B...
And these changes need to be reflected realtime to the DataGridView. So the comparision is between one original DataTable and another modified copy of the DataTable.