Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TRY...Catch problem
Message
De
01/10/2014 16:29:41
 
 
À
01/10/2014 16:22:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01608628
Message ID:
01608629
Vues:
72
From help: If FLOCK() fails to lock a table and returns False (.F.), FLOCK() does not generate an error. As a result, you cannot use FLOCK() to trigger an ON ERROR routine.

You can have the flock() in a loop, with a small delay. Another option is to change the value of Set Reprocess.

Update. What about this:
Try
   if !flock()
      error "Locking error" && This will raise an error
   endif
Catch
Endtry
>Hi All:
>
>I am running 2 instances of VFP to simulate a file sharing problem. When instance 1 says:
>
>
>USE foo EXCL
>
>
>This works in instance 2:
>
>
>	TRY
>		USE foo SHARED
>	CATCH TO ww
>		MESSAGEBOX('Problem!  You got error # ' + ALLTRIM(STR(ww.errorno)))
>	ENDTRY
>
>
>HOWEVER when instance 1 says:
>
>
>USE foo
>flock()
>
>
>the 2nd instance just hangs with the following message in the status bar:
>
>
>Attempting to lock... Press <esc> to cancel
>
>
>How can I handle that situation gracefully with TRY..CATCH? I need this since the other system seems to be doing something like flock() and there's no way I can get the user to change the program.
>
>Thanks,
>
>Yossi
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform