Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
'Record in use' error...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00147351
Message ID:
00147416
Vues:
32
>I had the same problem On Win NT 4. You have to lock the Table header before doing an insert. Becasue when you do an insert VFP tries to lock the header.
>
>Check to see if you have access. If so Lock the header then use the insert coimmand.
>
>I've got a Function Called Headlock
>
>Can use this function in a loop or use a timer event.
>
>IF RLOCK("0",alias())
> RETU(.T.)
>ENDIF
>
>EG.
>
>IF Headlock("MyAlias")
> Insert Into MyAlias
> Unlock
>Endif

EG's correct, but I'd expand the lock function to look like this, put it in a procedure file or your goApp and call it with the parameter of the file:

=Headlock("myAlias")
Insert...
UNLOCK

PROCEDURE HeadLock
LPARAMETER cfile

IF FLOCK(m.cfile)
RETURN
ENDIF
WAIT WINDOW NOWAIT NOCLEAR "Attempting to lock " +m.cfile +"...please wait."
DO WHILE ! FLOCK(m.file)
ENDDO
WAIT CLEAR

I also use a LockRec procdure similar to the above to lock a record before updating changes. I've found that by contolling the locking and unlocking manually elimiates conflicts.
Ken Sorce
Team RAD, Inc.
Rapid Application Developers
Ken@TeamRAD.com
www.teamrad.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform