求PB大神帮忙实现多条件查询情况string ls_1,ls_2,ls_3,ls_condition, ls_sql_new,ls_sql,ls_4 ls_1=trim (sle_1.text)ls_2=trim (sle_2.text) ls_3=trim (sle_4.text)ls_4=trim (ddlb_1.text)if ls_1="" and ls_2=""and ls_3="" and ls_4="" then Mes
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 08:52:11
求PB大神帮忙实现多条件查询情况string ls_1,ls_2,ls_3,ls_condition, ls_sql_new,ls_sql,ls_4 ls_1=trim (sle_1.text)ls_2=trim (sle_2.text) ls_3=trim (sle_4.text)ls_4=trim (ddlb_1.text)if ls_1="" and ls_2=""and ls_3="" and ls_4="" then Mes
求PB大神帮忙实现多条件查询情况
string ls_1,ls_2,ls_3,ls_condition, ls_sql_new,ls_sql,ls_4
ls_1=trim (sle_1.text)
ls_2=trim (sle_2.text)
ls_3=trim (sle_4.text)
ls_4=trim (ddlb_1.text)
if ls_1="" and ls_2=""and ls_3="" and ls_4="" then
MessageBox("提示","请填写查询条件!")
else dw_1.setfilter("(bookname like'%"+ls_1+"%') or (bookauthor like'%"+ls_2+"%') or (bookpub like'%"+ls_3+"%') or(booktype='"+ls_4+"')")
dw_1.filter()
dw_1.retrieve()
end if这是代码 有书名 作者 出版社 和类别4个条件 问题是 实现了单个条件的模糊查询 但是当两个条件一起时,结果出现的是满足两个条件的数据有什么办法 达到是并的效果 而不是和的 前提还是能够实现原来单个条件查询
求PB大神帮忙实现多条件查询情况string ls_1,ls_2,ls_3,ls_condition, ls_sql_new,ls_sql,ls_4 ls_1=trim (sle_1.text)ls_2=trim (sle_2.text) ls_3=trim (sle_4.text)ls_4=trim (ddlb_1.text)if ls_1="" and ls_2=""and ls_3="" and ls_4="" then Mes
楼主这样试试看能不能行
string ls_1,ls_2,ls_3,ls_condition, ls_sql_new,ls_sql,ls_4
ls_1=trim (sle_1.text)
ls_2=trim (sle_2.text)
ls_3=trim (sle_4.text)
ls_4=trim (ddlb_1.text)
if ls_1="" and ls_2=""and ls_3="" and ls_4="" then
MessageBox("提示","请填写查询条件!")
string str = "1 = 1";
Is_1!=""?str += "and (bookname like'%"+ls_1+"%')":;
Is_2!=""?str += "and bookauthor like'%"+ls_2+"%')":;
Is_3!=""?str += "and (bookpub like'%"+ls_3+"%')":;
Is_4!=""?str += "and (booktype='"+ls_4+"')":;
else dw_1.setfilter(str);
//else dw_1.setfilter("(bookname like'%"+ls_1+"%') or (bookauthor like'%"+ls_2+"%') or (bookpub like'%"+ls_3+"%') or(booktype='"+ls_4+"')")
dw_1.filter()
dw_1.retrieve()
end