Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any problem with autoinc int as free table pks?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01375975
Message ID:
01376425
Views:
15
OK. That is basically the same as Rick Strahl does. Thanks for the info.

Alex

>I wrote my routine prior to AutoInc functionality, but still prefer to generate my own
>
>Basically you have a table with the name of the ID, and the ID generated
>In my case the ID name is unique, but if it is not you can include the tablename also to make it unique if necessary
>
>Make a procedure/method that accepts a parameter for the ID
>search for that ID in the table, if not found, add it to the table with your default start value (I use 10000000, just for ascetics)
>If found, lock the record, bump the value, unlock the record, return new value
>
>I don't really think about it much because it's built into my data object
>In my case if I send a record to my data object without a uniqid, it calls the function and generates it automatically and passes back the value,
>
>Your welcome to my code snippet, but it's not difficult to code, and mine may not be generic enough for your use
>
>Good luck
Previous
Reply
Map
View

Click here to load this message in the networking platform