Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update at the same time
Message
De
24/01/2006 12:07:24
 
 
À
24/01/2006 11:55:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01089800
Message ID:
01089806
Vues:
7
This message has been marked as a message which has helped to the initial question of the thread.
Preempt this problem by putting in an attempt to lock the record - RLOCK(). If RLOCK() fails then just issue message like "Locked by another user"

>in the transaction, I used an 'Update' button, if the user clicks that button, it will update all the files:
>
>lOkay=.n.
>BEGIN TRANSACTION
>SELECT vinv
>IF TABLEUPDATE(.t.) AND GETNEXTMODIFIED(0)=0
>	SELECT vinvdetail

* HERE ------------------>
         If not RLOCK()
             WAIT WINDOW "sorry etc."
         Else

>	    IF TABLEUPDATE(.t.) AND GETNEXTMODIFIED(0)=0
>	  	    SELECT scard
>		    IF TABLEUPDATE(.t.) AND GETNEXTMODIFIED(0)=0
>			lOkay=.y.
>		    ENDIF
>	    ENDIF
         EndIf not RLOCK()

>ENDIF
>
>IF lOkay
>         END TRANSACTION
>ELSE
>	ROLLBACK
>	WAIT WINDOW 'Rollback, big problem'
>ENDIF
>
>but if two users click the button at the same time, one will get the Rollback message. any solution for that?
>
>thanks for the help
>
>regards,
>
>Jerry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform