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:
00196315
Views:
26
>I'd like to hear different methods to deal with ever existintg problem of avoiding to generate duplicate key numbers in a multi use environment.
>Specifically, we have a multi user application, we use a system table to keep the values of the last ID generated and use FLOCK() to prevent other user from getting to the table.
>This, for some reason doesn't work, we have found at one customer, duplication of ID's.
>The DataBase resides on an NT server and the APP resides on the workstations.
>Somebody suggested to me to use CoCreateGUID API call.
>I've been thinking about opening the system table exclusively while the new key is been generated.
>
>But I'd like to hear more ideas from you guys.
>
>Thanks
Hi Luis,

I assume that you're checking to make sure the FLOCK() didn't return .F. and that you either specified the workarea or made sure that the table you were trying to lock was in the current work area. If not, that's what I'd look at

BTW, I think that it's a more common practice to use RLOCK() to try to lock the record rather than the file. The practice is to issue a DO WHILE NOT RLOCK(), including a brief pause in the body of the loop.

hth,
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform