下面这个多重条件查询的程序我在运行完了以后出来的是空白页面,没有把符合条件的记录选出来,这是为什么呢?我是初学者,请各位高手帮忙看看,不胜感激!!! <% a=trim(request("year")) b=trim(request("month")) c=trim(request("date")) d=trim(request("CAT")) e=trim(request("province")) f=trim(request("BD")) g=trim(request("O&I")) h=trim(request("output"))
Function sql(x,y,sqls) if y<>"" then sqls=sqls & " and " & x & " like '%" & y & "%'" end if sql=sqls End Function
Set conn=Server.CreateObject("ADODB.Connection") DBpath=Server.MapPath("biao.mdb") Conn.Open "driver={Microsoft Access Driver (*.mdb)};pwd=;dbq=" & DBpath Set rs=Server.CreateObject("ADODB.Recordset") sqls="select * from ASB where 1=1 " sqls=sql("year",a,sqls) sqls=sql("month",b,sqls) sqls=sql("date",c,sqls) sqls=sql("CAT",d,sqls) sqls=sql("BD",e,sqls) sqls=sql("province",f,sqls) sqls=sql("O&I",g,sqls) rs.open sqls,conn,3,2 %>