Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't get a record to lock?
Message
 
 
À
15/10/2000 22:05:44
Raymond Humphrys
Michigan Department of Community Health
Bath, Michigan, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00429650
Message ID:
00429706
Vues:
14
>I can not get the following code to lock a record. What can can cause this failure? I've got multilocks on, and reprocess set to automatic for testing.
>
>STORE recno() to gcreclist2
>DO WHILE NOT RLOCK('myfile')
> RLOCK(str(gcreclist2), 'myfile') &&& Lock clinical record
> IF NOT RLOCK()
> Wait window "Somebody else is working on this record"
> ELSE
> UNLOCK
> ENDIF
>ENDDO
>
>thanks

The above code attempts to lock the current record in alias myfile once, record number gcreclist2 in alias myfile once and the current record in the current alias once.

These may be trying to lock the same record in the same alias or they may not. RLock() and FLock() not only return a logical value they also do the act. They actually attempt to lock the record or file and then return whether the attempt was successful. By having multiple calls to the function, you are introducing a lot of overhead to the process (especially if this is a network application and you connection is rather slow).

What work area are you in when you call this code? The recno() function does not specify an alias so it is using the current alias. Is this the work area you want? Maybe you should specify the alias as well here (i.e. recno('myfile')).
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform