|
-
Sep 26th, 2006, 09:14 AM
#1
Thread Starter
Member
VB.net 2005 & SqlServer & Locks & dm_tran_locks
Hi all. I was thinking you you guys could give me a help... i'm developing and Vb.net 2005 program, wich will be multi-user. I'm working either with SQL Server 2005 and actually working out in the locks. basicly i wanna lock in my program a row from a table, and only let anyone access it again, when it's not locked anymore. I've achieved this in the sql server 2005 query editor:
If you run
select sys.dm_tran_locks.* from sys.dm_tran_locks
(dm_tran_locks give you the current locks) you get all the locks aganist the database. I've done more:
select sys.dm_tran_locks.* from sys.dm_tran_locks where resource_type = 'Key' and resource_description = '(010086470766)'
This way i get only the Key locks on the specific resource_description. If i get rows returned, the row from the resource_description (010086470766) is locked. If not, it's not locked. Cool till here.
The problem is knowing the resource_description within Visual Basic. This way i know the resource_description when i attemp to lock some row, and i can use the query to see the row's avaliability.
Any suggestions finding the resource_description?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|