PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Relation Grand-parent/Grand-child in a typed DataSet
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Relation Grand-parent/Grand-child in a typed DataSet
![]() |
Relation Grand-parent/Grand-child in a typed DataSet |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hello !
I'm writing a very simple Windows App in C# with Visual Studio 2005. I have a DataSet composed like this : DataTable CLIENT DataTable COMMANDE DataTable ARTICLE Relation FK_CLIENT_COMMANDE : 1 CLIENT to many COMMANDE Relation FK_COMMANDE_ARTICLE : 1 COMMANDE to many ARTICLE I have implemented 3 DataGridViews : DataGridView : DgCLIENT bound to CLIENT DataGridView : DgCOMMAND (detail of DgCLIENT) bound to FK_CLIENT_COMMANDE DataGridView : DgARTICLE (detail of DgCOMMAND) bound to FK_COMMANDE_ARTICLE My problem : BidonDataSetPoub ds = (BidonDataSetPoub)bidonDataSetPoub.GetChanges(); aRTICLETableAdapter.Update(ds.ARTICLE.Select("","",DataViewRowState.Deleted)); cOMMANDETableAdapter.Update(ds.COMMANDE.Select("","",DataViewRowState.Deleted)); cLIENTTableAdapter.Update(ds.CLIENT.Select("", "", DataViewRowState.Deleted)); cLIENTTableAdapter.Update(ds.CLIENT.Select("","",DataViewRowState.ModifiedCurrent)); cOMMANDETableAdapter.Update(ds.COMMANDE.Select("","",DataViewRowState.ModifiedCurrent)); aRTICLETableAdapter.Update(ds.ARTICLE.Select("","",DataViewRowState.ModifiedCurrent)); cLIENTTableAdapter.Update(ds.CLIENT.Select("", "", DataViewRowState.Added)); cOMMANDETableAdapter.Update(ds.COMMANDE.Select("", "", DataViewRowState.Added)); aRTICLETableAdapter.Update(ds.ARTICLE.Select("", "", DataViewRowState.Added)); bidonDataSetPoub.Merge(ds, false); bidonDataSetPoub.AcceptChanges(); ------------------------------------------------------ |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Oops I forgot to describe my problem :-)
Let's say I add a CLIENT row in DgCLIENT And a COMMANDE row in DgCOMMANDE And a ARTICLE row in DgARTICLE The ARTICLE row won't be created in the DB. Now, if the COMMANDE row is already created in the DB, and if a add an ARTICLE row in DgARTICLE, the ARTICLE row is created in the DB. Can someonehelp ? |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Ok I found the answer :
------------------------------------------------------------------ Leave the AcceptRejectRule property on the ForeignKeyConstraint object as None, the default. If you set the property to Cascade, then submitting a pending insert on a child row will set the RowState on both the parent and related child rows to Unchanged and you won't be able to use a DataAdapter to submit the pending children to the database. ------------------------------------------------------------------ |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

