Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Record Lock
Message
De
05/03/2003 10:17:50
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Record Lock
Divers
Thread ID:
00761489
Message ID:
00761489
Vues:
57
Hello,

I am upsizing to sql server one of my foxpro application.

I would like to ask if anyone could help me with the following.

I my original application at one stage I update a record using the following mechanisim.

Select the record
Lock the record
Once locked check the satus field
and only if the status field meets my requirement I update the record.
Then Unlock

How can I reproduce that behaviour in SQL only unsing pass-trough and no remote views ?
I obviously use the locking mechanisim to ensure that no one changes the record while I am processing.
Also to make sure that no one change the record between the time I compare the status and the time I update.

Here My Fox Code :

SELECT tfiles
IF RLOCK()
&& First Check the current status
IF tfiles.fstatus <> "IN"
=MESSAGEBOX("File is not available, File not IN !",16,"Error")
Thisform.text2.SetFocus
UNLOCK IN tfiles
RETURN
ENDIF

SELECT tfiles
REPLACE fstatus WITH "REQ"

&& Do other stuff here

ELSE
=MESSAGEBOX("File in use by an other user, retry later",16,"Error")
ENDIF
UNLOCK IN tfiles


Many Thanks

Xavier
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform