Problem with Deleting record from databound list control

Problem with Deleting record from databound list control

Post by S. Shawn M » Sun, 11 Dec 2005 04:41:45


I get the following error when I try to remove an item from a list control
and the update the ds it is bound to.

"Concurrency violation: the DeleteCommand affected 0 of the expected 1
records."

Code being used.

lstControl.RemoverCurrentItem();
lstControl.EndEdit;
TableAdapter.Update();

To duplicate the problem I do the following.

1) Add new record.
2) Then delete the records just added.

I can close the program down and go to the same item and delete it without
any problems. Obviously something is not being done when the record is
added to release the record.

Any help will be appreciated.
 
 
 

Problem with Deleting record from databound list control

Post by Bart Mermu » Sun, 11 Dec 2005 08:04:31

Hi,




It's not entirely clear what lstControl actually is.

And do you have problems with the following sequence:
- Add Row
- TableAdapter.Update
- Delete newly added row
- TableAdapter.Update

Or with:
- Add Row
- Delete newly added Row
- TableAdapter.Update

Greetings