General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Network:
Windows 2000 Server
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only