What is the action of ForeinKeyConstraint.AcceptRule = Cascade - Ado.net 2.0

  • Thread starter Thread starter Rolf Welskes
  • Start date Start date
R

Rolf Welskes

Hello,
I have understand all about ForeignKeyConstraint .

But:
When I set

ForeignKeyConstraint.AcceptRule = AcceptRejectRule.None
or
ForeignKeyConstraint.AcceptRule = AcceptRejectRule.Cascade

I see no difference in behavor.

What is the difference (not what you can read in the help),
but what realy is the action wich takes place when I set to Cascade.

Thank you for any help.
Best Regards
Rolf Welskes
 
Hi Rolf,

I think what you mentioned about is the "AcceptRejectRule" property of
ForeignKeyConstraint. If I misunderstood anything, please don't hesitate to
correct me.
AcceptRejectRule is used when AcceptChanges() method called or
RejectChanges() method called. When either AcceptChanges or RejectChanges
is called on a row in the parent table, the AcceptRejectRule value
determines whether or not changes are propagated to corresponding rows in
the child table.
For example:
You deleted a row in Table_1, at the same time, the related rows in Table_2
will also be deleted.(if the DeleteRule is set to Rule.Cascade).
The state for each row is "deleted", and then you call
Table_1.AcceptChanges() method.
#1(AcceptRejectRule =AcceptRejectRule.None): Nothing will happen in Table_2;
#2(AcceptRejectRule =AcceptRejectRule.Cascade): the state of related rows
in Table_2 will be changed.

Hope this will help. Please feel free to let me know if you have anything
unclear and we will follow up.
Best regards,
Wen Yuan
 
Hello,
thank you for your informations.
It works fine.
Thank you again and best regards
Rolf Welskes
 
Back
Top