Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Duplicate numbers
Message
De
16/03/2010 22:24:23
 
 
À
16/03/2010 17:53:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01454921
Message ID:
01454989
Vues:
35
Hi Greg, thank you for your reply. I can not lock the whole table because it is used for other things. But I tried to lock the record and pass the next barcode number but on occasions, the number was duplicated if two operators where working on the system. When I closed and open the table, plus the rlock(), it seems to behave and I haven't seen any duplicates yet. Here is my modified code :
IF USED("barcno")
	USE IN barcno
ENDIF
IF NOT USED("barcno")
	SELECT 0
	USE barcno
endif		
select barcno 

nBarc=barcno.barcno  
IF nBarc <= 0
	MESSAGEBOX("This computer is not setup with barcode numbers","")
	RETURN
ENDIF 
IF RLOCK('barcno')	
	replace barcno with nBarc+1
	UNLOCK
else 
       MESSAGEBOX("The barcodes numbering file is in use, plese try again","")
	RETURN
ENDIF 	
FLUSH in barcno force
IF USED("barcno")
	USE IN barcno
ENDIF
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform