Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Avoid repeated values with more than two users
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01322172
Message ID:
01322319
Views:
14
>About Borislav code below:
>
>=======================================
>USE NewKey IN 0
>IF NOT FLOCK([NewKey])
> MessageBox([Somebody tries to add records right now, please try after a few seconds])
> RETURN
>ENDIF
>=====================================
>
>As far as I undesrtood, there is a small chance 2 users are
>saving the record at the same time. And also this event
>will last just for a little while (correct me if I am wrong)
>
>So instead I messagebox, is there a way that in case FLOCK( ) fails,
>the software would wait a second try it one or more times until it is sucessfully ?
>
>(because maybe in a second the user would be already saved his record)
>
>Moises

Sure.
That was just an example code, just to give you something to think of :-)
DECLARE Sleep IN WIN32API INTEGER
USE NewKey IN 0 && this is not needed IF you add that table in DE of the form
DO WHILE NOT FLOCK([NewKey])
   Sleep(1000) && Sleep for a second
   RETURN
ENDIF
....
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform