> You have to do child deletes before parent deletes. > You have to do parent inserts before child inserts.
[nods] Luckily in this particular case however, the parent record cannot be deleted, only amended If the parent is a new one, a default row is added to the DataTable, and the user amends that (hence my need to support inserts) > You can streamline that by > a) Child Deletes > b) All parent updates/inserts/deletes - simple dataadapter update > c) Child Inserts, Child Updats The problem I have is that step c doesn't do anything if I have a PrimaryKeyConstraint on the child tables (pointing to the parent PK column) > The problem is further aggravated in that for example, in > step c, you could have a transactional issue that requires a > roll back. You also need to rollback the datasets - because > when you do an update, it sets all the roll flags to being > updated. So what I usually do is copy the changes (using > getchanges) into temporary datatables - and pass those to the > dataadapter - and then when the Commit succeeds, I do a > DataSet.AcceptChanges() on all datasets being update. heh..pretty much the workaround I described in my second post ie pass the GetChanges of the parent to the adapter (effectively a copy in my case), get the new PK value from this "temporary" version of the parent, write this to the original parent record, (this updates the FK fields in the children), update the children passing them to their adapters, then finally call AcceptChanges. I just think that using GetChanges so that the roll flags are not updated is a bit of a hack..but obviously one you've had to do as well :-( Merak You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.