Ok, I've got a workaround, but this *can't* be the right way to do it surely? This is what I'm now doing:
Use GetChanges on the parent table If it doesn't return Nothing, I update *this* datatable instead I then manually read the updated PK field value from the 2nd table into the original (which then via the PKConstraints cascades to the child tables ... but this time without flagging them as updated Merak > -----Original Message----- > From: Chris Anderson [mailto:[EMAIL PROTECTED]] > Sent: 16 May 2002 10:57 > To: [EMAIL PROTECTED] > Subject: [DOTNET] ADO.NET multiple table updates > > > I have a dataset consisting of 3 datatables > > There is one parent table, and 2 child tables > > I have set up foreign key constraints (with UpdateRule = > Rule.Cascade) on the primary key, etc > > The user populates the parent table with a new record, then > populates the child tables, and finally hits update > > At this point, I want to save the dataset to the database (SQL Server) > > I've create the SPs, etc, and they work fine, but I'm having > problems updating the child tables > > I use a SQLDataAdapter to update the parent table, and the PK > field is updated from the database This in turn updates the > appropriate field in the child datatables via the foreignKeyContraints > > The problem, is that at this point, the child tables seem to > be updated (ie GetChanges returns Nothing, and no update gets > done when I pass it to it's > DataAdapter) > GetChanges *does* however return the changes before calling > update on the parent table, so I'm thinking that it's > expecting me to update all three tables in one shot. > > I'd supply code, but the above pretty well sums up the > situation (and the code is a little long winded) > > I've been on this for a few hours now, and the help samples either > update the parent table > add the records to the child DataTable > then update the child table > > or > the entire dataset is passed to the InsertCommand of > the parent table via GetXML > > I can't do the former, as the dataset is being populated > first and I can't do the latter as the dataset *could* be > quite large (resulting in indeterminately sized (and > potentially large) XML strings being passed to the SP) > > Hoping someone can help :-) > Merak You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.