2009-04-16 46 views

回答

2

如果你有VFP 8或更大:

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

+1

只是發現。但是,我發現我需要一個(空的)CATCH語句。 – 2009-04-16 18:40:13

1

對於舊版本:

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

if lSuccess ... 
0

我使用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