Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trigger message in dbc
Message
From
17/10/1998 11:31:13
 
 
To
17/10/1998 08:36:56
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00146775
Message ID:
00147792
Views:
36
>>John,
>>
>>In the Default Value of the ID field I put the code GenerateID("Mytable", "MyIndex") which calls a function GenerateID(). This function is kept in the same folder as the tables, although it COULD be added to the Stored Procedures.
>>
>>The function loads an ID table, looks for a record for 'MyTable' and defaults to the index 'MyIndex'. The record is locked, a value is incremented and the new value is used as the ID. With record locking I can be sure that only one user gets the next ID.
>>
>>And yes, this is always a Primary index.
>>
>>HTH
>>Barbara
>
>Barbara,
>
>Does putting the call to GenerateID() in the default value automaticaly add the new index value when you append a new record?

PMFJI- Yes. Automatically. Even in a browse.

>
>I use a seperate table and code to generate a unique index value for any table in the application. It sounds similar to the one you use except for the record locking (I have none at the moment).

If the app is multi-user, you will need to lock the record to prevent 2 clients from grabbing the same id before one has the chance to increment it.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform