The Insert and Delete Commands

Let’s look at the Insert and Delete statements the DataAdapter created. The Insert statement is the same whether or not we choose optimistic concurrency. Since we are adding a new row, we don’t have to worry about anyone else changing the row since it will not have existed yet. The only possible issue here is that someone else tries to add a row with a nonunique unique key. In this case, the server will abort the operation and the DataAdapter will simply throw an error.

There is a concurrency issue with the Delete statement beyond another user deleting the row before you do. What if another user made changes to the row that makes it undesirable to delete due to business rules or some other reason? For example, ...

Get ADO.NET Programming in Visual Basic™ .NET 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.