Re: Updating Parent and Child at same time

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

From: Sahil Malik (contactmethrumyblog_at_nospam.com)
Date: 10/26/04


Date: Tue, 26 Oct 2004 13:52:59 -0400

There is more to this problem than meets the eye.

First the simple answer(s) -
a) You can use ADO.NET transactions.
b) You can use database transactions.
c) Sql Server specific: You can pass in XML update grams directly from the
dataset to the stored procedure and have this change applied in one shot.
(Explained in my book - Chapter #12)

Now for the complex part --

For a dataset that has multiple parent/child relations, getting the changed
rows, and applying them properly in sequence is a royal pain in the butt.
But hey atleast in ADO.NET it is possible to deal with multi dimensional
data. For more on this - David Sceppa's ADO.NET book.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
Please reply to the newsgroups instead of email so everyone can benefit from
your reply.

"SouthSpawn" <southspawn@aol.com> wrote in message
news:9ba53d6ad8f81d9426dd8ebcc65ae459@localhost.talkaboutsoftware.com...
> Hello Everyone,
>
> I have a quick question.
>
> Let's say you have the following situation. You have a parent table and a
> child table. If I wanted to update both parent and child at the same time.
> What would be the best way to do this. The reason why I am asking. Doing
> two different inserts might be a bad idea. The reason being, what is the
> first insert works, and the second one fail. If you have any suggestions
> that would be great.
>
> Thanks,
> Mark
>



Relevant Pages

  • Re: Only child having only children?
    ... I don't think one, or the other, has 'veto' power (especially if it's ... How can you being a child into the world when one parent doesn't ... the couple has some a priori better reason than the other. ...
    (misc.kids)
  • Re: Only child having only children?
    ... woulnd't hurt an innocent, the child). ... the couple has some a priori better reason than the other. ... depth and intensity of the one who wants to parent more children. ... veto power kinda sews it up for them. ...
    (misc.kids)
  • Re: For Jill, Andre and others who want prison sentences for "paternity fraud"
    ... There's no reason we should need prison sentences, ... product of an affair beforehand, which would be a Not-Bad Thing. ... Any child should have the right to know it's actual parents. ... parent should have the right to know that they are the actual parent ...
    (soc.men)
  • Re: Teaching to ask nicely- what methods work?
    ... But if the child asked loudly, ... request was reasonable, or because it seemed wrong to say no ... I can think of three forms of "currency" a parent can use ... obvious to them that that's the reason. ...
    (misc.kids)