Sahil
Sun Mar 05 22:05:28 CST 2006
Just do a BeginTransaction, pass in IsolationLevel Serializable, assign that
to the SqlCommand.Transaction properties - and you have pessimistic locking.
Alternatively, use TransactionScope and dictate that Isolation level through
there - remember to manage your connection lifetime when mixing DataAdapter
and TxScope.
Or just change your commandtext to SELECT (HOLDLOCK) and manage connection
lifetime yourself .. same sh!t different smell.
Tonnes of ways of doing Pessimistic Locking in ADO.NET.
- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
__________________________________________________________
"Cor Ligthert [MVP]" <notmyfirstname@planet.nl> wrote in message
news:e52sGtHQGHA.1040@TK2MSFTNGP12.phx.gbl...
> Hi Bill,
>
>> You can open a Pessimistic lock in ADO.NET using transaction isolation.
>>
> I did not know that, do you have a simple sample for that using a
> DataSet(or a link to it). I have already searched long to find a solution
> for a real pesimistic lock with a dataset.
>
> Cor
>