Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Lock, Isolation levels , modes..

Author  Topic 

Tks
Starting Member

48 Posts

Posted - 2010-05-08 : 08:05:24
Can anyone help me with some ado/SQL code?

problem is that i cant find what i need.

basicly what i want is to select 1 row from a query with one column n the where...

Select top (1) ProdId from products where recinuse=0

then i want to update the inuse field to 1 (hope this helps sql...)

in the meantime i want that any other person / connection cant see the record i just grabbed from the table (don't want them to wait for it - makes no sense -)

i know i need to use with and some lock, problem is that i also have to cope with the ADOCOnnection settings (isolation level, mode) and with the dataset settings cursor type, locktype, cursor type..

anyone?

regards,

Tks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-08 : 10:28:04
seems like what you need is to apply rowlock.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Tks
Starting Member

48 Posts

Posted - 2010-05-08 : 11:25:51
okey, how can i apply that? any further comments?

I have now the situation that when one program opens the other gets the lock time-out message...



Go to Top of Page

Tks
Starting Member

48 Posts

Posted - 2010-05-08 : 12:34:58
found the solution in this link:

http://www.mssqltips.com/tip.asp?tip=1257

Go to Top of Page
   

- Advertisement -