July 7, 2002 at 1:51 am
Hi Friends,
I was working in a project VB+SQL Server. I was little bit confusion about recordlocking in a multiuser app. I think SQL Serve has it's own locking options available. In my VB app. I'm using ADODB recordset. How can I open a recordset from SQL Server by locking record. Is the below statement is correct
SELECT * FROM customer WITH (UPDLOCK)
If so how can I check a particular record has already locked by someone. Pls send me code/links about locking record in a multiuser environment
Thanks in advance
Manoj
P.B. No 14337
Doha - Qatar
Ph: 4435361
web:www.fccqatar.com
P.B. No 14337
Doha - Qatar
Ph: 4435361
web:www.fccqatar.com
July 7, 2002 at 7:15 am
There's no simple way to determine if a record is locked. Typically if you try to select a locked record your request will be "blocked", so you wait until it becomes available or the attempt times out (assuming you are not using hints to override).
You can force a lock using ADO and specifying a pessimistic lock, then it should hold a lock once you begin editing the record. Depending on your needs, you may want to implement your own locking scheme where a record gets tagged with the userid of the requestor and is then unavailable for editing (but not selecting) to all other users.
Andy
July 8, 2002 at 6:09 am
How to lock a table in SQL Server 2000? I mean i would like to run a stored procedure and want that during the time the stored procedure no change to the table should be done from any other users
July 8, 2002 at 7:01 am
Use the tablockx hint. BOL has more info about all the available hints.
Andy
July 8, 2002 at 8:33 am
There was a list of articles i found on the link you provided but none spoke of locking. Can you please tell which of those articles dealt with Database Locking
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply