Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Lock a Sql server record
Message
From
11/04/2007 10:49:23
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01214142
Message ID:
01214432
Views:
14
Physically locking a record can be problematic (user goes to lunch and the record remains locked). In our previous application, we hadn't had the need for record-locking (the chance of the same users updating the same records at the same time were extremely minimal and not worth the time to implement any concurrency methodology for that particular application).

Now, however, we are designing a few new applications for which this *will* be an issue. We are planning on using semaphore-locking instead of actual physical locks. We haven't implemented any of it yet, it's still being talked about and we just haven't gotten to that part of it yet, so I can't really give you any details other than to say that we felt that this approach was better than physical locks on the database.

~~Bonnie




>Hi.
>I'm looking for an RLOCK() equivalent in C#/Sql Server
>Situation is as follows:
>Web Form, Lots of uers, Single Table
>Any user can highlight any record and amend it.
>Uses Disconnected Record, User Views, It , Possibly Amends it, and saves It
>If another User has the Record, I want a visual clue on the form, and an indication that it it is read Only.
>In VFP . I would do something like:
>If Rlock()
> messageBox('You can only View')
>Endif
>
>I realise one could use Optimistic Concncurrency, but the user will not know about this until he has spent a lot of time amneding say 20 fields, to find out (at the end ) that a different user is also amending
>The user needs to know when they FIRST view the record that somebody else is using the record. Also, the user saving the record will need an Unlock facility
>
>I presume that are ways of handling this scenario in a Disconnected fashion, in Sql Server,but I dont have any such experience of this, hence the question.
>
>Regards,
>Gerard
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform