数据窗口dw_1中的字段wjjxh,在EDIT中设置了下拉数据窗口,下拉数据窗口d_wjjhselect的SQL如下:

SELECT wjjdy.wjgh,
wjjdy.wjjmc,
wjjdy.xh,
wjjdy.flid
FROM wjjdy

在窗口w_danganmovewjj中想实现,根据柜号过滤文件夹,在DW_1的CONSTRUCTOR中:

long ll_ret
datawindowchild ldwc_1
ll_ret = this.getchild('wjjxh' , ldwc_1)
ldwc_1.setfilter("wjgh ='"+gs_wjgh+"'" + "and not xh ='"+string(gi_wjjxh)+"'")
ldwc_1.filter()
上面代码没有正确执行,但是我在查询分析器中执行下面SQL能正确执行:
SELECT wjjdy.wjgh,
wjjdy.wjjmc,
wjjdy.xh,
wjjdy.flid
FROM wjjdy
where wjgh = '001' and xh <> 74;
哪里出了问题请指点一下,谢谢!
------解决方案--------------------
"and not xh ='"+string(gi_wjjxh)+"'") "
是不是这个不正确呢?
你要的是不等于对吧?试下写成:and xh <> '"+string(gi_wjjxh)+"'"
------解决方案--------------------
"and not xh ='"+string(gi_wjjxh)+"'") "
应该没有问题,我也这么用,查过帮助了。
看不出哪里有问题,请大侠出招!
------解决方案--------------------
上面的括号写的有问题,试试以下的代码
long ll_ret
datawindowchild ldwc_1
ll_ret = this.getchild('wjjxh' , ldwc_1)
ldwc_1.setfilter("(wjgh ='"+gs_wjgh+"'" + ") and (xh <>'"+string(gi_wjjxh)+"')")
ldwc_1.filter()
或
long ll_ret
datawindowchild ldwc_1
ll_ret = this.getchild('wjjxh' , ldwc_1)
ldwc_1.setfilter("(wjgh ='"+gs_wjgh+"'" + ") and not (xh ='"+string(gi_wjjxh)+"')")
ldwc_1.filter()