469,643 Members | 1,670 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

Pessimistic locking

How do i do Pessimistic locking in ado.net
with c#

Thanks DaveP
Mar 28 '07 #1
1 2502
This is really kind of a loaded question since often it may be better to use
a timestamp (rowversion column) and often you can get better performance
with stored procs, but the basic pattern would be as follows:

Create a transaction with an IsolationLevel of RepeatableRead.
Set your DataAdapter’s SelectCommand property to use the transaction.
Make the changes to your data.
Set the DataAdapter’s Insert, Update, and Delete command properties to use
the transaction.
Call the DataAdapter’s Update method.
Commit the transaction.

HTH,
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"DaveP" wrote:
How do i do Pessimistic locking in ado.net
with c#

Thanks DaveP
Mar 29 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Nid | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.