Row-Level Locking in MSSQL 7 using ADOgreenspun.com : LUSENET : SQL Server Database Administration : One Thread |
Dear Sir,I’m having a hard time trying to make my application acquire one of those neat row-level locks that were introduced in MSSQL 7. I tried this query in visual basic 6 using ADO?
SELECT * FROM tablename WITH (UPDLOCK ROWLOCK) WHERE condition SELECT * FROM tablename WITH (HOLDLOCK ROWLOCK) WHERE condition SELECT * FROM tablename WITH (HOLDLOCK) WHERE condition
but these queries are not working if one user modifying the records other user also able to modify the same records. Please reply to my mail.
Thanks and regards, Rasheed
-- Anonymous, November 17, 2004
Rasheed,Your sample code shows the lock on the select statement. Since select statements typically run quickly, the lock would not be in effect very long. You probably want to create transactions and have the lock for the entire transaction.
Hope this helps,
Eric
-- Anonymous, November 19, 2004