What is Data Concurrency and Types of Concurrency Control in ADO.NET.


When multiple users attempt to modify data at the same time, controls need to be established in order to prevent one user’s modifications from adversely affecting modifications from simultaneous users. The system of handling what happens in this situation is called concurrency control.

Types of Concurrency Control
Three common ways to manage concurrency in a database:

  • Pessimistic concurrency control: A row is unavailable to users from the time the record is fetched until it is updated in the database.
  • Optimistic concurrency control: A row is unavailable to other users only while the data is actually being updated. The update examines the row in the database and determines whether any changes have been made. Attempting to update a record that has already been changed results in a concurrency violation.
  • “Last in wins”: A row is unavailable to other users only while the data is actually being updated. However, no effort is made to compare updates against the original record; the record is simply written out, potentially overwriting any changes made by other users since you last refreshed the records.