Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Locking records
Message
From
01/05/2005 13:01:00
Randy Wessels
Screentek Business Solutions, Llc.
Phoenix, Arizona, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Locking records
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01010015
Message ID:
01010015
Views:
60
I have some code that I inherited that involves an order entry system. Some people are complaining that they are getting the same order number assigned twice.

SET EXCLUSIVE ON
SELE acomp
IF LOCK('acomp') != .T.
loopcount = 0
DO WHILE LOCK('acomp') = .F. .OR. loopcount = 200
IF LOCK('acomp') = .T.
EXIT
ENDIF
loopcount = loopcount + 1
ENDDO
ENDIF
IF LOCK('acomp') != .T.
=MESSAGEBOX('Please try again.',64,'Too much Network Traffic.')
THISFORM.RELEASE
ENDIF
THISFORM.curordnum = acomp.nextfakenum
REPLACE acomp.nextfakenum WITH acomp.nextfakenum + 1
TABLEUPDATE(2,.T.,'acomp')
UNLOCK IN acomp
SET EXCLUSIVE OFF

Does anyone see where this is going wrong? It works fine 95% of the time. This is a multi-user application, but I think most of the dups are happening from the same session.

Thanks,

Randy Wessels
Next
Reply
Map
View

Click here to load this message in the networking platform