Frnak,
First, I'm glad that I was able to help you, please be kind to mark my post
as helpfull by pressing Yes at the bottom of the mesage
Second, you where using the GetChanges method that is described here:
http://msdn.microsoft.com/library/de...ngestopic1.asp
If you'll loook there you'll see that "Relationship constraints may cause
Unchanged parent rows to be included. " (from the Remark section) so I assume
that for some reason the relations where not passed to the DataSet which
caused the problem because the DataSet expected some other rows which where
not passed.
As I wrote to you, I think that it is better to directly update the DataSet
and not to create a new DataSet and then Merge it back...
--
Shai
"Frnak McKenney" wrote:
>
> Shai,
>
> Thank you for responding so quickly.
>
> On Tue, 28 Jun 2005 02:55:01 -0700, Shai Goldberg <(E-Mail Removed)> wrote:
> > I have had some problems with the mothod youare using:
> > - If dataset.HasChanges(), then
> > - temp_dataset = dataset.GetChanges()
> > so I'm using the DataAdapter's Updtae method directly on the DataSet it self
> > instead of transfering the changed data into a different DataSet.
> > you can check if there are changes using the dataset.HasChanges but try to
> > update the dataset tables with the fill instead of creating a new dataset.
> > the update in such a case will not affect unchanged rows and should update
> > only the changed rows.
>
> This sounded like it might be handy, but I didn't see how it applied
> to what I was doing, so I snapped a copy for my archive and went
> back to my code.
>
> I was up late last night, so it took almost half an hour of staring
> at my "update" routine before what you had been saying started to
> sink in. It finaly dawned on me that what I was doing:
>
> temp_ds = master_ds.GetChanges();
> foreach (table in temp_ds) {
> table.GetChanges()
> update database copy of table
> }
>
> was only slightly different from:
>
> foreach (table in master_ds) {
> table.GetChanges()
> update database copy of table
> }
>
> "Oh. ... THAT'S what he was talking about!"
>
> My earlier "silly stuff" tests:
>
> >> DataTable dt1 = dsPgtDb.Tables["TableA"].GetChanges();
> >> DataTable dt2 = dsPgtDb.Tables["TableB"].GetChanges();
> ....etc.
>
> had already shown me that _this_ route (that is, ignoring the
> usually recommended approach and _not_ creating a changes-only
> dataset) wouldn't blow up. So I made a backup copy of the class
> source code file, simplified my code slightly, and...
>
> IT WORKS!!!
>
> I'll leave it to someone more knowledgeable about these things (and
> who's not under a project deadline) to explain why I can invoke
> GetChanges on every DataTable in a DataSet with no problem, but
> issuing a GetChanges() for that whole DataSet triggers a
> ConstraintException. I'm not thrilled about it -- I really like for
> things that seem similar to behave similarly -- but at least I'm off
> and running again.
>
> When the dust settles on my current project, I may go back and see
> if I can come up with some sort of routine that will do DataSet
> consistency checking. If this turns out to be an ADO bug it won't
> help me much, but I've been known to make... er, "a few" errors of
> my own. <grin>
>
>
> Thanks again, Shai.
>
>
> Frank McKenney, McKenney Associates
> Richmond, Virginia / (804) 320-4887
> Munged E-mail: frank uscore mckenney ayut minds pring dawt cahm (y'all)
> --
> "A ship in harbor is safe, but that is not what ships are built for."
> -- John A. Shedd
> --
>