Cómo determinar si está abierta exclusiva tendrá éxito en FoxPro?

StackOverflow https://stackoverflow.com/questions/757406

  •  09-09-2019
  •  | 
  •  

Pregunta

Si intento para ganar una mesa exclusiva abierta en FoxPro, genera un cuadro de diálogo si se deniega el acceso. Desde que estoy focalización una aplicación no interactiva, hay una manera de detectar si la operación tendrá éxito, o al menos tener que falle en silencio?

¿Fue útil?

Solución

Si usted tiene VFP 8 o superior:

TRY
    USE MyTable IN 0 EXCLUSIVE
ENDTRY
...
IF USED ("MyTable")
    *-- Use the table here
ENDIF

Otros consejos

Para versiones anteriores:

cOldError = ON("ERROR")
ON ERROR *
USE MyTable IN 0 EXCLUSIVE
lSuccess = used("MyTable")
ON ERROR &cOldError

if lSuccess ...

He tenido éxito en el uso FOPEN ...

nFHdl = FOPEN("myfile.dbf", 1)  &&  1 tries to open the file for writing
IF nFHdl > 0 THEN
   FCLOSE(nFHdl)
   USE myfile.dbf exclusive
ELSE
   = messagebox("Can't open Exclusive")
ENDIF
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top