<form name="myform" method="post" action="chanshows.asp"> <table width="170" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td>
<% rs.open "select * from category order by categoryorder",conn,1,1 if rs.eof and rs.bof then response.write "没有!" response.end else %> <div align="center"> <select name="categoryid" size="1" id="categoryid" onChange="changelocation(document.myform.categoryid.options[document.myform.categoryid.selectedIndex].value)"> <option selected value="<%=rs("categoryid")%>"><%=trim(rs("category"))%></option> <%
selclass=rs("categoryid") rs.movenext do while not rs.eof %> <option value="<%=rs("categoryid")%>"><%=trim(rs("category"))%></option> <% rs.movenext loop end if rs.close %> </select></div> <Br> <div align="center"><select name="sortsid"> <% rs.open "select * from sorts where categoryid="&selclass ,conn,1,1 if not(rs.eof and rs.bof) then %> <option selected value="<%=rs("sortsid")%>"><%=rs("sorts")%></option> <% rs.movenext do while not rs.eof %> <option value="<%=rs("sortsid")%>"><%=rs("sorts")%></option> <% rs.movenext loop end if rs.close rs.open "select * from TimesProList",conn,1,1 %> </select> </div> </td> </tr> <tr> <td height="35"> <div align="center"> <input name="key" type="text" size="12"><input type="submit" name="Submit" value="查找"> </div></td> </tr> </table> </form> 这个是查询,目标文件是chanshows.asp 下面是chanshows.asp 的代码, <% pages=cint(request.querystring("pages")) categoryid=Request("categoryid") sortsid=request("sortsid") key=Request("key") if categoryid="" then sql3="select * from product order by id desc" end if if sortsid<>"" and categoryid<>"" and len(key)=0 then sql3="select * from product where sortsid="&sortsid&" and categoryid="&categoryid&" order by id desc" end if if sortsid="" and categoryid="" then sql3="select * from product order by id desc" end if if categoryid<>"" then sql3="select * from product where categoryid="&categoryid&" and recommend=0 order by id desc" end if if len(key)<>0 and sortsid<>"" then sql3="select * from product where name like'%"&key&"%'and sortsid="&sortsid&" order by id desc" end if if len(key)<>0 and sortsid<>"" and categoryid="" then sql3="select * from product where name like'%"&key&"%'and sortsid="&sortsid&" order by desc" end if Set rs1 = Server.CreateObject("ADODB.Recordset") rs1.open sql3,Conn,3,2 if rs1.EOF then response.Write "<script language='javascript'>alert('暂时还没有图片信息!');history.go(-1);</script>"
不知道为什么,查小类查不着,一查小类就把那个大类的东西全显示,关键字查询的没事,能查着,,大家看看是哪的事我看了代码,没有错呀,为什么会出现这种情况,取不着sortsid的值