Handle DataAdapter Concurrency Errors
Problem
You are performing an update that might fail because of a concurrency error.
Solution
Handle the DataAdapter.RowUpdated event and check for errors, or set the DataAdapter.ContinueUpdateOnError property to True.
Discussion
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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.