Handle DataAdapter Concurrency Errors


You are performing an update that might fail because of a concurrency error.


Handle the DataAdapter.RowUpdated event and check for errors, or set the DataAdapter.ContinueUpdateOnError property to True.


If the DataAdapter executes an update command and detects that the number of affected rows is 0, it throws a DBConcurrencyException. The entire update operation will be aborted, and no further rows in the DataSet will be examined.

Usually, a DBConcurrencyException occurs for one of two reasons:

  • You have incorrectly written the SQL for a custom UPDATE, INSERT, or DELETE command.

  • The row can’t be found because the information being used to find it doesn’t match the current values. This problem ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.