Check ALL relations for ChildRows before removing a DataRow?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello NG!

In a DataSet I have the tables A, B und C.
Table B is related to A with DeleteRule=Cascade
Table C is related to A with DeleteRule=None

This way an exception is thrown, if you try to remove a Row in A and there
are depending ChildRows in C. But ChildRows in B are already removed before
that exception is thrown.

So after that action I still have a Row in A, I still have ChildRows in C,
but I have no ChildRows in B.

Is there a possibility to check ALL relations, before the whole
removing-action is performed? Something like a transaction.
Please notice, that that problem is related to the .NET-CompactFramework,
which in my opinion does not know, what's a transactions, does it?

Any suggestions?

Thanks, D.Barisch
 
In a DataSet I have the tables A, B und C.
You might check it manually?

But what If I Table B and C are related to other tables themselves? What I
want is a flexible solution, that not only works for the tables A, B and C.
I need that for a remove-function within an edit-dialog, so I thought there
is an mechanism like it is usual in "real" dbms. Even MS Access has this
functionality, so I wonder why it isn't implemented in DataSets.

Thanks, D.Barisch
 
Hi Daniel,

But what If I Table B and C are related to other tables themselves? What I
want is a flexible solution, that not only works for the tables A, B and
C.

It would work for more tables.
I need that for a remove-function within an edit-dialog, so I thought there
is an mechanism like it is usual in "real" dbms. Even MS Access has this
functionality, so I wonder why it isn't implemented in DataSets.

After re-reading it is not clear to me: is DeleteRule=Cascade within DataSet
or database?
Why don't you simply put there a DataRelation between tables with
DeleteRule=Cascade?
 
After re-reading it is not clear to me: is DeleteRule=Cascade within
DataSet
or database?

It's within the DataSet.
Why don't you simply put there a DataRelation between tables with
DeleteRule=Cascade?
The DeleteRule is a Property of the ForeignKeyConstraint, that is created
automatically, if I create a DataRelation Between the Tables.

D.Barisch
 
Back
Top