Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't get a record to lock?
Message
De
16/10/2000 10:03:02
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:
00429728
Vues:
18
I have since slimmed this down to the following:
LOCAL llLocked
llLocked = .F.

DO WHILE NOT llLocked
IF RLOCK("MyFile")
llLocked = .T.

ELSE
WAIT WINDOW "Couldn't Lock Record !"

ENDIF

ENDDO


When I get to this code I am using alias "myfile". This more ligHtweight version still will not let me lock my record. Another I've noticed is that I can lock a record once, but when I come back and try to lock another record, a different one, I can't. Same result, can't lock.

What can be holding the lock? Is it on the header, the file?


>>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')).
Some days it's not worth chewing through the leather straps ...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform