Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sequential numbers
Message
From
22/11/2002 11:49:49
 
 
To
22/11/2002 11:04:52
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00725809
Message ID:
00725841
Views:
10
Gaylen,

In addition to Sylvain's and Nadya's good points, I would put add a FLUSH statement. Take a look at the article about primary keys on Craig's website (www.craigberntson.com), you'll see where to FLUSH *grin*. Also, he uses FLOCK(), rather than RLOCK().

>I use the following code to create sequential numbers compliments of Michael.
>The code has worked fine until the last several days where it is creating duplicate numbers.
>
>
>LOCAL lnOldSel,lnCompteur
>lnOldSel=SELECT()
>lnCompteur=0
>IF ! USED('key_no')
> USE key_no IN 0
>ENDIF
>SELECT key_no
>1
>DO WHILE (NOT RLOCK()) AND (INKEY(0.1)=0) AND lnCompteur<=25
>   lnCompteur=lnCompteur+1
>ENDDO
>REPLACE NUMERO WITH NUMERO+1
>UNLOCK
>SELECT(lnOldSel)
>RETURN key_no.NUMERO
>
>
>
>The server is Windows 2000 server and using VFP 7.0.
>
>
>Any idea what may be happening or is there an inherent flaw in the code.
>
>Thanks
>Gaylen
Steve Gibson
Previous
Reply
Map
View

Click here to load this message in the networking platform