在foxpro中如何判断独占打开是否会成功?

发布于 2024-07-17 17:12:40 字数 93 浏览 9 评论 0原文

如果我尝试获取在 FoxPro 中打开的独占表,如果访问被拒绝,它会生成一个对话框。 由于我的目标是非交互式应用程序,有没有办法检测操作是否会成功,或者至少让它静默失败?

If I attempt to gain an exclusive table open in FoxPro, it generates a dialog box if access is denied. Since I'm targeting an non-interactive application, is there a way to detect whether the operation will succeed, or at least have it fail silently?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

望她远 2024-07-24 17:12:40

如果您有 VFP 8 或更高版本:

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

If you have VFP 8 or greater:

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

还不是爱你 2024-07-24 17:12:40

对于旧版本:

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

if lSuccess ...

For older versions:

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

if lSuccess ...
枯寂 2024-07-24 17:12:40

我已经成功使用 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

I've had success using 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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文