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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement