Pessimistic Concurrency – Using Transactions 

This demo shows how pessimistic concurrency can be implemented in an ASP.NET solution, which uses ADO.NET

The solution uses the Northwind SQL Server database. There is a module-level variabele ConnString, which holds the connection information (not awfully great in a web solution). You will have to enter your own connection string information there.

You can lock the database by clicking the Lock database button. If you then enter a new name in the New Name from 2nd User text box and click the 2nd user tries to update buttonn, this update attempt will time out.

If you relase the lock, the update will succeed. You won't see it until you have refreshed the page, though.

Pessimist.aspx

Pessimist.aspx.vb