Question : Strange problem with tableAdapterManager.Update<wbr />All and related tables

Hi experts

I have a strange problem with the UpdateAll.
There are two tables. a parent and a child with a relation defined both in SQL Server and the DataSet.
Now, when I call UpdateAll to store a new parent and a new related child, the parent gets inserted without problem.
But as soon as the autogenerated ParentTableAdapter.Update is called, the related child row gets the RowState "Modified" (before that it was "Added").
So, when the child's Update() method is called there is only a modified row. The application now tries to update a non-existant row which results in a exception.

Anybody an idea why the child row is set to "Modified" as soon as I insert the parent row?
I can't figure it out.

I'm using VS2008, .NET Framework 3.5 and SQL Server 2005 Express Edition

Thanks

Answer : Strange problem with tableAdapterManager.Update<wbr />All and related tables

Found the problem.

If you set the AcceptRejectChangesRule in your DataRelation to "None" it works perfectly.
"Cascade" results in the behaviour explained above.

If understand it correctly my parent table passed the AcceptChanges to my childtable which commited the changes in my childtable.

Random Solutions  
 
programming4us programming4us