|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
The DeleteCommand affected 0 recordserror when I try to update my table using a typed dataset which contains serveral tables. The Delete/UpdateCommand affected 0 records All my tables are related and all relationships are configured. For simplicity I'm going to stick to two table. Parent and child. The relationsship is defined with a cascading delete. So if I delete a row in the parent, the child row is also marked as deleted. This is where the problem starts. Booth tables have a dataadapter in which the SQL-statements (MS SQL) are defined. When I the adapter of the child table is executed (this is after the dataadapter of the parent executed) I recieve the error as described in the subject. But when I just delete the child directly, it is deleted without any errors. I'm the only one working with (testing) the program, so there is no possibility anyone else changed the record while I was working on it. So, when I delete the row in the childtable directly, no problem. When the row is deleted through a cascading delete (via the parenttable) I recieve an error when the dataadapter of the childtable executes the updatestatement. What am I doing wrong? During the configuration of the adapters I used Optimistic Concurrency. Thx I was thinking, maybe if the delete of the child is caused by a
cascading delete of the parent, the original row values of the child are lost so the deletestatement of the DataAdapter update-method doesn't work anymore. Could this be the problem? Hi,
This is an often handled problem in this newsgroup. Can you have a look for yourself? http://groups.google.com/group/microsoft.public.dotnet.framework.adonet/search?group=microsoft.public.dotnet.framework.adonet&q=UpdateCommand+affected+0+records&qt_g=1&searchnow=Search+this+group There are of course more threads this is about Update, I thoutht that about delete it is even more. I hope it helps something Cor <s.buss***@symax.nl> schreef in bericht Show quote news:1144696818.727505.46760@e56g2000cwe.googlegroups.com... > Hi, as many before me, and probably after me, I recieved the following > error when I try to update my table using a typed dataset which > contains serveral tables. > > The Delete/UpdateCommand affected 0 records > > All my tables are related and all relationships are configured. For > simplicity I'm going to stick to two table. Parent and child. The > relationsship is defined with a cascading delete. So if I delete a row > in the parent, the child row is also marked as deleted. This is where > the problem starts. Booth tables have a dataadapter in which the > SQL-statements (MS SQL) are defined. When I the adapter of the child > table is executed (this is after the dataadapter of the parent > executed) I recieve the error as described in the subject. But when I > just delete the child directly, it is deleted without any errors. > > I'm the only one working with (testing) the program, so there is no > possibility anyone else changed the record while I was working on it. > > So, when I delete the row in the childtable directly, no problem. When > the row is deleted through a cascading delete (via the parenttable) I > recieve an error when the dataadapter of the childtable executes the > updatestatement. > > What am I doing wrong? > > During the configuration of the adapters I used Optimistic Concurrency. > > Thx > |
|||||||||||||||||||||||