Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Avoid repeated values with more than two users
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01322172
Message ID:
01322319
Vues:
15
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform