求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/08/31 16:08:28
![求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=](/uploads/image/z/6237582-6-2.jpg?t=%E6%B1%82PB%E5%A4%A7%E7%A5%9E%E5%B8%AE%E5%BF%99%E5%AE%9E%E7%8E%B0%E5%A4%9A%E6%9D%A1%E4%BB%B6%E6%9F%A5%E8%AF%A2%E6%83%85%E5%86%B5string+ls_1%2Cls_2%2Cls_3%2Cls_condition%2C+ls_sql_new%2Cls_sql%2Cls_4+ls_1%3Dtrim+%28sle_1.text%29ls_2%3Dtrim+%28sle_2.text%29+ls_3%3Dtrim+%28sle_4.text%29ls_4%3Dtrim+%28ddlb_1.text%29if+ls_1%3D%22%22+and+ls_2%3D%22%22and+ls_3%3D%22%22+and+ls_4%3D%22%22+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 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