主题:求助!!!!
我想实现的功能就是实现多条件的数据检索,有个添加条件按钮,点一下生成一个条件
行,然后输入条件,关键词,即可检索.代码如下
set rs=server.CreateObject("adodb.recordset")
if request.form("检索")<>empty then
dim a(11),q,r,b(10)
for q=1 to 11
a(i)=request.Form("select"&q)
next
b(1)=request.Form("guanjianci1")
for r=2 to 10 step 2
b(i)=request.Form("guanjianci"&r)
next
rs.open "select * from product where "&a(1)&" like '%%"&b(1)&"%%' "&a(3)&" "&a(2)&" like '%%"&b(2)&"%%' "&a(5)&" "&a(4)&" like '%%"&b(4)&"%%' "&a(7)&" "&a(6)&" like '%%"&b(6)&"%%' "&a(9)&" "&a(8)&" like '%%"&b(8)&"%%' "&a(11)&" "&a(10)&" like '%%"&b(10)&"%%',conn,1,1
else
rs.open "select * from product order by "&px&"",conn,1,1
end if
%>
<%
if rs.eof then
server.Transfer("error.asp")
%>
.........
其中a(1,2,4,6,8,10)是检索的列(如"商品名称"),a(3,5,7,9,11)是"与"和"或"
b(1,2,4,6,8,10)是关键词.所有列类型都是文本.不知道哪错了???
行,然后输入条件,关键词,即可检索.代码如下
set rs=server.CreateObject("adodb.recordset")
if request.form("检索")<>empty then
dim a(11),q,r,b(10)
for q=1 to 11
a(i)=request.Form("select"&q)
next
b(1)=request.Form("guanjianci1")
for r=2 to 10 step 2
b(i)=request.Form("guanjianci"&r)
next
rs.open "select * from product where "&a(1)&" like '%%"&b(1)&"%%' "&a(3)&" "&a(2)&" like '%%"&b(2)&"%%' "&a(5)&" "&a(4)&" like '%%"&b(4)&"%%' "&a(7)&" "&a(6)&" like '%%"&b(6)&"%%' "&a(9)&" "&a(8)&" like '%%"&b(8)&"%%' "&a(11)&" "&a(10)&" like '%%"&b(10)&"%%',conn,1,1
else
rs.open "select * from product order by "&px&"",conn,1,1
end if
%>
<%
if rs.eof then
server.Transfer("error.asp")
%>
.........
其中a(1,2,4,6,8,10)是检索的列(如"商品名称"),a(3,5,7,9,11)是"与"和"或"
b(1,2,4,6,8,10)是关键词.所有列类型都是文本.不知道哪错了???