Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File Locking
Message
 
À
21/01/2001 23:46:47
Agnes Cheng
DynamicTech Consultants Ltd.
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00466456
Message ID:
00468886
Vues:
17
You can do it f.ex like this:


Function Getinvnumber

LOCAL ;
lnOldSel, ;
lnOldReProcess, ;
llUsed, ;
lncRetVal


m.lnOldSel = SELECT()
m.lnOldReProcess = SET('REPROCESS')
m.lncRetVal = -1


SET REPROCESS TO 5 && or what best suits for you. Look help for set reprocess.

IF !USED('Invnumber')
USE Invnumber shared
Else
SELECT Invnumber
m.llUsed = .T.
Endif

IF FLOCK()
GO BOTTOM
m.lncRetVal = InvNumber.Invnumber + 1
INSERT INTO INVNUMBER (INVNUMBER) VALUES (m.lncRetVal)
*!* You may save changes if Invnumber.dbf is buffered with
*!* TABLEUPDATE(.T.,.T.)
UNLOCK
ELSE
*!* Maybe some messages here
*!* messagebox(Can't ...',64,'')
ENDIF

*!* Cleanup
IF !m.llUsed
USE
Endif

SELECT (m.lnOldSel)
SET REPROCESS TO (m.lnOldReProcess)

*!* If -1 is returned this function couldn't get the invnumber.
RETURN m.lnRetVal
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform