Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Muli-user invoice number generation routine
Message
From
17/03/1998 14:17:22
 
 
To
17/03/1998 14:07:28
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00085150
Message ID:
00085154
Views:
27
>How would I generate a unique invoice number (sequential) in a multi-user environment, and guarentee no two users get the same number . I know I have to use file locking, but what is the canned procedure.

You have separate table Setup.dbf (two fields Tablename and Counter) with separate records for each table where sequential is needed.
Procedure GetNewId
lParameter cTablename
Select setup
Locate Setup.Tablename=cTablename
if not found()
 return 0
endif
if rlock()=.f.
 return 0
endif
replace Setup.counter with Setup.counter+1
unlock
return Setup.counter
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform