The DeleteCommand affected 0 records

S

s.bussing

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
 
S

s.bussing

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top