注册 登录
编程论坛 VFP论坛

这种错误如何捕捉

laowan001 发布于 2022-05-25 09:18, 900 次点击
在on error ...之后
xcursorname = sys(2015)
如果xcursorname还未建立,use &xcursorname会报错,也能捕捉到
但是如果是:select * from &xcursorname into cursor newcursorname,会弹出文件对话框,程序就停在这里一直等待选择(不报错)或取消(报错)
请教:对这种情况能否不打开对话框,而当做错误被捕捉到呢?
2 回复
#2
csyx2022-05-25 13:07
为何不先判断是否已打开而要做错误捕捉?如果是我一定这样处理:
if !used(m.xcursorname)
    ... 创建或生成临时表
endif
use (m.xcursorname) 或 select ... from (m.xcursorname)

如果一定要作为错误来捕捉这样也能凑合

if !used(m.xcursorname)
   error 13, m.xcursorname
endif


[此贴子已经被作者于2022-5-25 13:40编辑过]

#3
独木星空2022-05-26 14:05
回复 楼主 laowan001
看样子,laowan001先生研究的vfp广泛而且精深。像我这个人,只分析我需要方面的vfp知识点,就单薄的很,就像学字词句那样,用不到的从来就不去触碰,下功夫去学,在这点上向laowan001先生学习了。
1