By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,717 Members | 2,069 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,717 IT Pros & Developers. It's quick & easy.

READING/MERGING XML DATA

P: n/a
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!
Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
> 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.

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Klatuu" <Kl****@discussions.microsoft.com> wrote in message news:1A**********************************@microsof t.com...
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!

Jul 21 '05 #2

P: n/a
> 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.

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Klatuu" <Kl****@discussions.microsoft.com> wrote in message news:1A**********************************@microsof t.com...
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!

Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.