Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unique ID Key Issue
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00196308
Message ID:
00196729
Views:
30
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform