I am trying to find difference between two tables from two different
datasources using dataset concepts. I need to update one of the table
if there is a difference in values of the columns and insert new row if
there is no match. To keep it simple, please assume the schema is same.
I have one dataset Dataset A from a legacy db as the source and have
another dataset B with a new db as the source. The dataset A and
dataset B has the same schema. I need
to get only the changes in A to be sent over to B. So I was trying to
do a merge having dataset B as target. Note: I have created a primary
key on both dataset. The merge brings the new rows from A over to B,
but it makes the other rows which are same as modified.
I used the haschanges method on the dataset B to see the results.
So I ended up looping through each datarow from dataset A, and then
query against the primray key for dataset B, then checking each column,
to see if there are changes. and if no rows present, ended up
inserting.
Can anyone confirm if the dataset merge behaviour works like above ?
|