Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Locking records
Message
 
 
À
01/05/2005 13:01:00
Randy Wessels
Screentek Business Solutions, Llc.
Phoenix, Arizona, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01010015
Message ID:
01010036
Vues:
50
Take a look at http://www.craigberntson.com/Articles/kb006.htm

>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.
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform