Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
NewID() working randomly
Message
De
19/08/1999 07:13:21
Rex Mahel
Realm Software, Llc
Ohio, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00254709
Message ID:
00255189
Vues:
16
PMFJI, but the NewId table needs to be a table so you can lock the record until the value is iterated. If it were a view, two users could get the same value for the key but only one could update the underlying table correctly.

HTH

Rex


>I'm using a NewID() function to lookup "NextKey" values for adding records to my database. This function suites my needs perfectly when it works, but for some reason, it doesn't always work. I haven't pinned down what changes occur in my project that disable this function, but they're NOT changes in the DB, as that has been unchanging.
>
>* Excerpt from function NewID()
>*=================================
>IF ! USED("rv_nextkey")
> USE "eis!rv_nextkey" IN 0
>ELSE
> REQUERY("rv_nextkey")
>ENDIF
>
>IF _TALLY = 1
> MESSAGEBOX("_Tally was successfull")
> SELECT rv_nextkey
> llSuccess = .F.
> DO WHILE ! llSuccess
> lnRetVal = rv_nextkey.nextkey
> REPLACE rv_nextkey.nextkey WITH rv_nextkey.nextkey + 1
>*etc..
>*=================================
>
>I've been stepping through the above code and for some reason the USE "eis!rv_nextkey" IN 0 isn't returning _TALLY = 1
>
>The entry for _TALLY in Hacker's Guide doesn't list USE as being a command that changes _TALLY, but, as I said, this code does work sometimes. (The code actually came from another FVP book, so somebody else thought it should work as well).
>
>Browsing the NextKey table with the correct parameters gives the expected results, I just can't figure out why this function is inconsistent.
>
>Any suggestions?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform