PC Review


Reply
Thread Tools Rate Thread

Accept/Reject Cascading - DataSet

 
 
Mr Newbie
Guest
Posts: n/a
 
      19th Nov 2005
DataSet Parent/Child + Relation.

When you update the parent table, then after each row is updated in the db,
the adapter will call AcceptChanges on that row, marking that row as
unchanged. When AcceptRejectRule is set the Cascade, then AcceptChanges is
called on all related child rows marking them as unchanged too.

In what scanario would this cascade be useful ?


 
Reply With Quote
 
 
 
 
luxspes
Guest
Posts: n/a
 
      20th Nov 2005
Mr Newbie wrote:
> DataSet Parent/Child + Relation.
>
> When you update the parent table, then after each row is updated in the db,
> the adapter will call AcceptChanges on that row, marking that row as
> unchanged. When AcceptRejectRule is set the Cascade, then AcceptChanges is
> called on all related child rows marking them as unchanged too.
>
> In what scanario would this cascade be useful ?
>
>

Whenever you have a master detail relationship? :$
 
Reply With Quote
 
Mr Newbie
Guest
Posts: n/a
 
      20th Nov 2005
Not true.

I am using a master detail relationship, but I dont want the changes to a
master record to be reflected neccesarilly to its children when the specific
data changes does not warrant it.

Take a situation where we create a master first and then its children in the
dataset. Then you create the master in th SQL database but all your children
are then marked unchanged stopping you from addin them too.



--
Best Regards

The Inimitable Mr Newbie º¿º
"luxspes" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Mr Newbie wrote:
>> DataSet Parent/Child + Relation.
>>
>> When you update the parent table, then after each row is updated in the
>> db,
>> the adapter will call AcceptChanges on that row, marking that row as
>> unchanged. When AcceptRejectRule is set the Cascade, then AcceptChanges
>> is
>> called on all related child rows marking them as unchanged too.
>>
>> In what scanario would this cascade be useful ?

> Whenever you have a master detail relationship? :$



 
Reply With Quote
 
luxspes
Guest
Posts: n/a
 
      20th Nov 2005
Mr Newbie wrote:
> Not true.
>
> I am using a master detail relationship, but I dont want the changes to a
> master record to be reflected neccesarilly to its children when the specific
> data changes does not warrant it.
>
> Take a situation where we create a master first and then its children in the
> dataset. Then you create the master in th SQL database but all your children
> are then marked unchanged stopping you from addin them too.


If the temporary (in dataset) primary key of the master row changes on
saving (i.e. when using autoincrement in the database) then, if you dont
change the reference of the child row to match the new primary key of
the master... you will end up with orphaned records... wouldn't you?


>
>
>

 
Reply With Quote
 
Mr Newbie
Guest
Posts: n/a
 
      20th Nov 2005
Yes, but this particular rule cascase Accept/Reject Rule calls the Accept
Changes in the child, and this means that they will not be inserted by the
update method of the DataAdapter.

Try it !

--
Best Regards

The Inimitable Mr Newbie º¿º
"luxspes" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Mr Newbie wrote:
>> Not true.
>>
>> I am using a master detail relationship, but I dont want the changes to a
>> master record to be reflected neccesarilly to its children when the
>> specific data changes does not warrant it.
>>
>> Take a situation where we create a master first and then its children in
>> the dataset. Then you create the master in th SQL database but all your
>> children are then marked unchanged stopping you from addin them too.

>
> If the temporary (in dataset) primary key of the master row changes on
> saving (i.e. when using autoincrement in the database) then, if you dont
> change the reference of the child row to match the new primary key of the
> master... you will end up with orphaned records... wouldn't you?
>
>
>>
>>


 
Reply With Quote
 
Bart Mermuys
Guest
Posts: n/a
 
      20th Nov 2005
Hi Mr Newbie,

"Mr Newbie" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> DataSet Parent/Child + Relation.
>
> When you update the parent table, then after each row is updated in the
> db,
> the adapter will call AcceptChanges on that row, marking that row as
> unchanged. When AcceptRejectRule is set the Cascade, then AcceptChanges
> is
> called on all related child rows marking them as unchanged too.
>
> In what scanario would this cascade be useful ?


I found a thread on google describing one situation where it can be
required:

http://groups.google.be/group/micros...11a31b0eeb225e

HTH,
Greetings

>
>



 
Reply With Quote
 
Mr Newbie
Guest
Posts: n/a
 
      20th Nov 2005
Hmm......, Tricky eh!

Well, it sounds like there is no hard and fast way to deal with this, it's a
case of grow your own solution depending on the type of implementation you
need.

Its a Delete vs Create dialema when you are dealing with both parent AND
child variations in the local Dataset.

Thanks for the link.

--
Best Regards

The Inimitable Mr Newbie º¿º


"Bart Mermuys" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Mr Newbie,
>
> "Mr Newbie" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> DataSet Parent/Child + Relation.
>>
>> When you update the parent table, then after each row is updated in the
>> db,
>> the adapter will call AcceptChanges on that row, marking that row as
>> unchanged. When AcceptRejectRule is set the Cascade, then AcceptChanges
>> is
>> called on all related child rows marking them as unchanged too.
>>
>> In what scanario would this cascade be useful ?

>
> I found a thread on google describing one situation where it can be
> required:
>
> http://groups.google.be/group/micros...11a31b0eeb225e
>
> HTH,
> Greetings
>
>>
>>

>
>



 
Reply With Quote
 
Bart Mermuys
Guest
Posts: n/a
 
      20th Nov 2005
Hi,

"Mr Newbie" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hmm......, Tricky eh!
>
> Well, it sounds like there is no hard and fast way to deal with this, it's
> a case of grow your own solution depending on the type of implementation
> you need.


Sort off, yes.

The link is mostly about the fact that some databases allow you to delete a
parent row in which case it deletes the child rows itself. And then it
depends on whether you take advantage of that or not. You don't have to you
can still first delete the child rows and then the parent row.

The update sequence for the latter is explained in "Managing an @@IDENTITY
Crisis" and requires AcceptRejectRule to be None.

Greetings



>
> Its a Delete vs Create dialema when you are dealing with both parent AND
> child variations in the local Dataset.
>
> Thanks for the link.
>
> --
> Best Regards
>
> The Inimitable Mr Newbie º¿º
>
>
> "Bart Mermuys" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi Mr Newbie,
>>
>> "Mr Newbie" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> DataSet Parent/Child + Relation.
>>>
>>> When you update the parent table, then after each row is updated in the
>>> db,
>>> the adapter will call AcceptChanges on that row, marking that row as
>>> unchanged. When AcceptRejectRule is set the Cascade, then AcceptChanges
>>> is
>>> called on all related child rows marking them as unchanged too.
>>>
>>> In what scanario would this cascade be useful ?

>>
>> I found a thread on google describing one situation where it can be
>> required:
>>
>> http://groups.google.be/group/micros...11a31b0eeb225e
>>
>> HTH,
>> Greetings
>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Mr Newbie
Guest
Posts: n/a
 
      20th Nov 2005
Thanks Bart. I did read Bill's note on the @@Identity crisis which was quite
helpfull

--
Best Regards

The Inimitable Mr Newbie º¿º
"Bart Mermuys" <(E-Mail Removed)> wrote in message
news:OBVd$(E-Mail Removed)...
> Hi,
>
> "Mr Newbie" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hmm......, Tricky eh!
>>
>> Well, it sounds like there is no hard and fast way to deal with this,
>> it's a case of grow your own solution depending on the type of
>> implementation you need.

>
> Sort off, yes.
>
> The link is mostly about the fact that some databases allow you to delete
> a parent row in which case it deletes the child rows itself. And then it
> depends on whether you take advantage of that or not. You don't have to
> you can still first delete the child rows and then the parent row.
>
> The update sequence for the latter is explained in "Managing an @@IDENTITY
> Crisis" and requires AcceptRejectRule to be None.
>
> Greetings
>
>
>
>>
>> Its a Delete vs Create dialema when you are dealing with both parent AND
>> child variations in the local Dataset.
>>
>> Thanks for the link.
>>
>> --
>> Best Regards
>>
>> The Inimitable Mr Newbie º¿º
>>
>>
>> "Bart Mermuys" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi Mr Newbie,
>>>
>>> "Mr Newbie" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> DataSet Parent/Child + Relation.
>>>>
>>>> When you update the parent table, then after each row is updated in the
>>>> db,
>>>> the adapter will call AcceptChanges on that row, marking that row as
>>>> unchanged. When AcceptRejectRule is set the Cascade, then
>>>> AcceptChanges is
>>>> called on all related child rows marking them as unchanged too.
>>>>
>>>> In what scanario would this cascade be useful ?
>>>
>>> I found a thread on google describing one situation where it can be
>>> required:
>>>
>>> http://groups.google.be/group/micros...11a31b0eeb225e
>>>
>>> HTH,
>>> Greetings
>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
David Sceppa [MSFT]
Guest
Posts: n/a
 
      29th Nov 2005

Nice catch, Bart. It's always nice to see a two and a half year old
response to a thread is still helpful.

David Sceppa
Microsoft
This posting is provided "AS IS" with no warranties,
and confers no rights. You assume all risk for your use.
© 2005 Microsoft Corporation. All rights reserved.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Accept or Reject a value crabflinger Microsoft Excel Worksheet Functions 0 3rd Apr 2009 05:46 PM
Accept or Reject a value crabflinger Microsoft Excel Worksheet Functions 0 3rd Apr 2009 05:20 PM
Accept or Reject Changes Erik Feenstra Microsoft Word Document Management 3 3rd Apr 2008 04:04 AM
Accept/Reject Option =?Utf-8?B?S2FyZW5Z?= Microsoft Outlook Discussion 0 12th Sep 2005 09:41 PM
MW2K will only let me accept or reject all =?Utf-8?B?QnViYmExOTcw?= Microsoft Word Document Management 0 9th Aug 2004 10:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:05 PM.