Re: Merging rows with Identity col into orig DataSet after updatin

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Nima (Nima_at_discussions.microsoft.com)
Date: 09/08/04


Date: Tue, 7 Sep 2004 19:11:02 -0700

Thanks David for the suggestion. When deleting a row that my binding manager
is pointing to, the binding manager ends up pointing to the previous row.
Then I have the problem of pointing the binding manager to the new row. I
can hack it, but this must be a common problem and I am pretty sure that it
has an elegant solution built into the framework that I am missing. Please
help.

"David Browne" wrote:

>
> "Nima" <Nima@discussions.microsoft.com> wrote in message
> news:5AE4E060-446D-49E8-8129-B91F549DC26F@microsoft.com...
> > Hello,
> >
> > I am trying to insert data into a database on the other end of a web
> > service. The primary key in my DataTable is an identity column. I first
> > get
> > a copy of my dataset with only the changes in it by calling
> > DataSet.GetChanges. I then pass this little DataSet across the wire where
> > my
> > insert stored procedure first inserts the records from the little DataSet
> > into the database and then the SELECT statements at the end of the stored
> > procedure updates my little DataSet so it gets the identity PK value from
> > the
> > database. I then pass this little DataSet back to my client and want to
> > merge it with my original DataSet.
> >
> > So lets say I insert a new row on the client, the DataSet will give it a
> > PK
> > value of -1 (my AutoIncrementSeed and AutoIncrementStep values are -1),
> > this
> > record is then sent to the server, the database is updated properly (via
> > DataAdapter.Update), the DataSet used for this is then updated with the
> > latest values from the data base (thanks to the SELECT statement at the
> > end
> > of my stored procedures). At this point the PK value is now say 34 (from
> > the
> > database). Now I ship this little DataSet back to the client and need to
> > merge its values with those in the bigger DataSet on my client. If I use
> > DataSet.Merge, the row with the -1 PK remains in the big DataSet and a new
> > row with PK of 34 is added to it.
> >
> > What is the best way / standard way to merge in a situation like this?
> >
>
> On the client, you could remove all the rows with negative numbers for the
> PK, and then merge.
>
> David
>
>
>



Relevant Pages

  • Re: ANN: DynDNS update client for VMS
    ... Don't know David. ... DynDNS' specifications have a number of policies regarding client ... Unofficial OpenVMS Hobbyist Support Page: ...
    (comp.os.vms)
  • Re: My Library _passes_ TaskSpeed in IE < 7
    ... were it for a client who's business I did not know inside out. ... were it for a client I could milk more billable hours to ensure mobile ... While David may have made some valid points and illustrated some errors in the past 2.5 years (really? ... I don't know if the libraries support it or not as, again, I don't care. ...
    (comp.lang.javascript)
  • Re: Serious issue with Outlook 2003 and SBS 2003, I need help
    ... >> Well David, ... >> I don't care about cached mode on my workstations, ... >> for my laptop users. ... >> client wants to store it on the server for security. ...
    (microsoft.public.windows.server.sbs)
  • Re: 15,000 episode... (not a spoiler - perhaps)
    ... pointing me to this epi, as I wasn't going to bother. ... In his place I would have been moved by how upset Ruth was, and chastened by the fact that my dalliance with Sofa might have contributed, but I suppose David is somewhat emotionally unintelligent... ...
    (uk.media.radio.archers)