Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unique ID Key Issue
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00196308
Message ID:
00196729
Vues:
39
>Luis,
>
>I hit the button too fast, here's the example code
>
>
>* NewKey.prg
>LPARAMETERS pcTableName
>LOCAL lnNewKey, lcAlias, lcOrder, lnBuffering
>lcAlias = ALIAS()
>IF NOT USED("System")
>   USE System AGAIN ALIAS System
>ELSE
>   SELECT System
>ENDIF
>lnBuffering = CursorGetProp("BUFFERING","System")
>CursorSetProp("BUFFERING",0,"System")
>lcOrder = SET("ORDER")
>SET ORDER TO TableName
>SEEK UPPER(ALLTRIM(pcTableName))
>IF NOT FOUND()
>   INSERT INTO System (TableName, NextKey) VALUES (UPPER(pcTablename), 1)
>   lnNewId = 0
>ELSE
>   DO WHILE NOT RLOCK()
>   ENDDO
>   lnNewKey = System.NextKey
>   REPLACE NextKey WITH NextKey + 1
>   UNLOCK
>ENDIF
>CursorSetProp("BUFFERING",lnBuffering,"System")
>IF NOT EMPTY( lcOrder )
>   SET ORDER TO &lcOrder
>ELSE
>   SET ORDER TO 0
>ENDIF
>IF NOT EMPTY( lcAlias )
>   SELECT ( lcAlias )
>ELSE
>   SELECT 0
>ENDIF
>RETURN lnNewKey
>
Hi JimB,

I got not so much a question as a solicitation of an opinion, if you don't mind. What would you think of returning BINTOC(lnNewKey)? I understand that there are advantages in using characters in this sort of situation. Any disadvantages?

tia,
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform