[求助]关于多重组合查询的问题!大家来看看吧!
这段代码是用来实现多重查询的.可是他只有4个条件都输入才能查询,哪位高手来帮忙改改,让它但个输入条件的时候也能正确查询!string kh1,txm1,pm1,ys1;
string newsyn,ls_kh,ls_txm,ls_pm,ls_ys
string ls_sqlold
ls_kh=sle_kh.text
ls_txm=sle_txm.text
ls_pm=sle_pm.text
ls_ys=sle_ys.text
newsyn = &
"select cg_cprk.rk_no,cg_cprk.txm,gg_cpzl.txm,gg_cpzl.kh_dm,cg_CPRK.xh, GG_cpzl.PM_DM,GG_cpzl.SH, GG_cpzl.CM_DM from cg_cprk,gg_cpzl" &
+ " where gg_cpzl.txm= cg_cprk.txm and gg_cpzl.kh_dm='"+ls_kh+"' and cg_cprk.txm='"+ls_txm+"' and gg_cpzl.pm_dm='"+ls_pm+"' and gg_cpzl.sh='"+ls_ys+"' "
//显示所有结果
if ls_txm = '' and ls_kh = '' and ls_pm = '' and ls_ys = '' then
w_seek.dw_1.settransobject(sqlca)
//w_seek.dw_1.setfilter(newsyn)
//w_seek.dw_1.filter()
w_seek.dw_1.retrieve()
//显示多条件查询结果
else
//if w_seek.dw_1.retrieve() = 0 then
//w_seek.dw_1.setsqlselect()
ls_sqlold=w_seek.dw_1.GetSQLSelect()
w_seek.dw_1.settransobject(sqlca)
w_seek.dw_1.SetSQLSelect(NewSyn)
//w_seek.dw_1.setfilter(newsyn)
//w_seek.dw_1.filter()
w_seek.dw_1.retrieve()
w_seek.dw_1.SetSQLSelect(ls_sqlold)
sle_kh.text=""
sle_txm.text=""
sle_pm.text=""
sle_ys.text=""
messagebox("查询结果!","总共查询到"+string(w_seek.dw_1.rowcount())+"条记录符合查询内容!",information!,ok!)
end if
close(w_seek_filter)