Locks In C#

pessimistic lock

Middle Tier


TransactionOptions TransOpt = New TransactionOptions();
TransOpt.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
using(TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, TransOptions)) {}

ADO.NET (DAta Access Layer)

ADO.NET stands for ActiveX Data Object is a database access technology created by Microsoft as part of its .NET framework that can access any kind of data source.

SqlTransaction objtransaction = objConnection.BeginTransaction(System.Data.IsolationLevel.Serializable);

SQL

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;