以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 关于find中的关系表达式应用变量的问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=81488) |
-- 作者:5159518 -- 发布时间:2016/2/29 10:28:00 -- 关于find中的关系表达式应用变量的问题 命令窗口代码如下: Dim hh As String = Tables("入库").Current("存储_盒号") output.show(hh) Dim gh As String = Tables("入库").Current("存储_格号") Dim dr As DataRow = DataTables("存储").Find("盒号 = \'hh\'") Dim dv As String = dr("存储编号") output.show(dv) 执行后显示: A000000001 和报警:“未将对象引用到对象的实例” 当将代码改为: Dim hh As String = Tables("入库").Current("存储_盒号") output.show(hh) Dim gh As String = Tables("入库").Current("存储_格号") Dim dr As DataRow = DataTables("存储").Find("盒号 = \'A000000001\'") Dim dv As String = dr("存储编号") output.show(dv) 就没有错误了,可以正常执行 所以应该就是在:Find("盒号 = \'hh\'")处的’hh’出错了,但是尝试着去掉单引号、换成()、[],同样是报错,不知道究竟应该怎么改,帮助文件里面没有找到相关的内容,不知道是没有还是我没有找到的原因,请老师指教 [此贴子已经被作者于2016/2/29 10:34:02编辑过]
|
-- 作者:大红袍 -- 发布时间:2016/2/29 10:41:00 -- Dim hh As String = Tables("入库").Current("存储_盒号") Dim gh As String = Tables("入库").Current("存储_格号") Dim dr As DataRow = DataTables("存储").Find("盒号 = \'" & hh & "\'") If dr IsNot Nothing Dim dv As String = dr("存储编号") output.show(dv) Else output.show("没找到") End If |
-- 作者:5159518 -- 发布时间:2016/2/29 10:44:00 -- 谢谢老师,我刚刚也找到了修改的方法,正打算跟帖,刷新之后发现您已经回帖了,呵呵,还是很感谢您啊 |