Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to generate key field values
Message
From
24/07/1998 23:21:09
 
 
To
23/07/1998 10:07:03
Mandy Mccord
Public Interest Breakthroughs, Inc.
Albany, New York, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00120429
Message ID:
00121288
Views:
15
>Just curious what folks think out there regarding what's the best way to generate key field values when adding new records to tables.
>
>When my users click the ADD button, I've been running code to use the table in the key field order, go bottom, find the last value and add 1 to it for the new record's key field value.
>
>It seems to be working fine, though I realized I had to play with my SET DELETED ON/OFF commands so my next value was unique and not the same as a deleted record's.
>
>I know some folks keep separate tables to track the next available key value for their tables. I'm assuming it looks like a 2 field table, one for the table's name, one for the next value. You'd then check there for the next value you want to assign.
>
>Any way better than any other??
>
>MTIA!!
>
>Mandy

I use the 2nd method.

I generate the key field on the save routine if I'm using row/table buffering.

if I'm using SQL I issue my select statement with "UPDLOCK" to get the next available key field value.
System Analyst
Nabil B. Ghrayyeb
nabilg@hotmail.com
Previous
Reply
Map
View

Click here to load this message in the networking platform