Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check for Exclusive Open?
Message
From
13/01/2003 14:49:23
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00741115
Message ID:
00741147
Views:
23
Marvin,

Leroy's suggestion will work almost all the time, possibly even all of the time. But it does have a whole in it...someone could theoretically open the file in the short period of time between the function call and your attempt to USE the table.

The best method is to do what Garret has suggested. You can make a function that does this for you. Something like this:
lcOldError = on("error")
llOpenError = .f.
on error llOpenError = .t.
use table1.dbf exclusive in 0
on error &lcOldError
if !llOpenError
   * we opened the file exclusively
else
   * could not exclusively open file
endif
>What is the best way to check to see if a table can be open exclusively before opening it exclusively and getting an error?
>
>In this case I want to do an ocassional PACK if there are no other users using the database, but of course use summary excl produces an error if other users are using the db.
>
>Thanks!
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform