Visual Foxpro "File in use" 使用 "Use Exclusive"

Visual Foxpro "File in use" using "Use Exclusive"

我正在 Visual Foxpro 8.0 中编写 delete/pack 例程。

当 运行 以下代码时 "Use" 语句使用 "Exclusive":

我得到 "File in use"
    USE dbbudget_log EXCLUSIVE
    DELETE ALL 
    pack
    use
    SET SAFETY ON 

我什至尝试过 SET EXCLUSIVE ON/OFF,但仍然出现 "File in use" 错误。

有什么消除错误的建议吗?

此致, 尼克

这意味着该文件已经在另一个会话中使用。该会话可能属于尝试独占使用的用户或网络上的其他人。 此外,use ... EXCLUSIVE 不保证文件被独占使用(如果它已经在共享模式下打开,那么它将继续在共享模式下使用并且不会引发错误)。 您可以针对这两种情况进行防御性编码:

local llHadError
On error m.llHadError = .T.
select 0
use dbbudget_log exclusive
zap
use
on error
* if m.llHadError && something went wrong
* ....
* endif