DataTable.Merge()

  • Thread starter Thread starter mj2736
  • Start date Start date
M

mj2736

I'm a little confused about DataTable.Merge(). I have two DataTable
objects with the same structure - dtOrig and dtCurrent. The end result
I'm trying to achieve is to get all the rows in dtCurrent that are in
some way different from the corresponding rows in dtOrig so those new/
modified/deleted rows can be processed. My idea was to use
dtOrig.Merge(dtCurrent), and then call dtOrig.GetChanges(). But what I
found is that when the preserveChanges Merge() parameter is
'false' (or not supplied) the values in dtOrig do get updated, but the
RowState stays 'Unchanged'. When preserveChanges is 'true' then the
RowState for all rows becomes 'Modified' but the values in dtOrig are
NOT actually updated! What am I missing here? Is there a better way to
go about this? Thanks.
 
Back
Top