Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Muli-user invoice number generation routine
Message
De
17/03/1998 14:17:22
 
 
À
17/03/1998 14:07:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00085150
Message ID:
00085154
Vues:
23
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform