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
 Need Help: record Locking

Author  Topic 

JasonAnt
Starting Member

23 Posts

Posted - 2007-09-07 : 23:55:58
Project spec:
If user is making Delivery Order for sales order,
the other user cannot make Delivery order for same sales order

How to lock a sales-order record, so other user cant use it, except for reporting (read only). I dont want to use a field since it has a lot of weakness. I am using VB6 and connect with ADO

Thanks

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-09-08 : 00:24:58
Use sql as backend? It handles locking for you.
Go to Top of Page

JasonAnt
Starting Member

23 Posts

Posted - 2007-09-08 : 00:37:45
Thank for replying rmiao,
maybe if describe the process flow more clearly you can understand what I want

HeaderTable:
OrderId: 001
Customer, date, etc

DetailTable:
OrderId:001
Item: Pencil
OrderQty: 100
OutstandingQty: 80

Process logic for delivery order
Choose SalesOrderID, get Item and outstandingQty, input delivery Qty
at this moment, max quantity of pencils is 80 pcs
but if at the same moment other user use the same OrderId,
he can input max 80 pcs of pencils too

How to protect this, I can do validation before save the transaction, but its not what they want
I am using SQL server 2000
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-09-08 : 01:03:35
You may use proper isolation level for that, check books online for details.
Go to Top of Page
   

- Advertisement -