READING/MERGING XML DATA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Whew, I've struggled my way through figuring out how to use XML to transport
data..now I can imagine what having a baby is like :)

But, I'm stuck now. I generate the XML (single table, no indexes) and
populate a dataset using READXML. I then merge the contents of that DS (call
it DS1) with a second DS (call it DS2) that I've created on the form that
will be used to process the data transfer. I did that so my SQL would be
generated (I thought I was making my life easier). Well, it turns out that
the row state of the rows in DS2 are set to UNCHANGED after the data from DS1
are merged, so the inserts never happen when I do a DA.UPDATE(DS2). I clear
DS2 before the merge, by the way, so there are no existing rows prior to the
merge.

Any help would be very much appreciated!
 
I clear DS2 before the merge, by the way, so there are no existing rows prior to the merge.

I wonder, why are you merging datasets if you have cleared one of them? Doesn't that defeat the purpose?

btw..

If you merge, lets say ds1 with ds2, using ds2.Merge(ds1, true)
then ds2.HasChanges() will return true if :

ds2.HasChanges() returned true before the merge
or
ds1.HasChanges() returned true before the merge.

If AcceptChanges has been called prior to the merge on both datasets, then ds2.HasChanges() will return false. In other words,
merging does not affect the state of the rows.

Using an adapter to fill the data, i.e. SqlDataAdapter1.Fill(DataSet1), will automattically call AcceptChanges for you.
 
Back
Top