%
key=rp(Request("key"))
classid=rp(Request("classid"))
if key=Empty then
key=""
End if
if not isnumeric(classid) then
classid=0
End if
if classid=0 then
showtitle="全部产品"
else
showtitle=showclassname(classid,"2")
End if
Dim objrs1,strsql1
if classid=0 then '全部解答
strsql1="select count(*) as recount from productlist where pname like '%" & key & "%'"
else
strsql1="select count(*) as recount from productlist where pname like '%" & key & "%' and classid=" & classid
End if
set objrs1=server.createobject("ADODB.Recordset")
objrs1.open strsql1,objconn,1,2,1
pagesize=10
pagecount=cint(objrs1("recount")-1)\pagesize+1
pageno=checkpage(rp(Request.querystring("page")),pagecount)
m=(pageno-1)*pagesize
Dim objrs,strsql
if m=0 then
if classid=0 then
strsql="select top " & pagesize & " id,pname,explain,classid,addtime,sphotopath from productlist where pname like '%" & key & "%' order by isgood desc,pid,addtime desc,id"
else
strsql="select top " & pagesize & " id,pname,explain,classid,addtime,sphotopath from productlist where pname like '%" & key & "%' and classid=" & classid & " order by isgood desc,pid,addtime desc,id"
End if
else
if classid=0 then
strsql="select top " & pagesize & " id,pname,explain,classid,addtime,sphotopath from productlist where id not in(select top " & m & " id from productlist where pname like '%" & key & "%' order by isgood desc,pid,addtime desc,id) and pname like '%" & key & "%' order by isgood desc,pid,addtime desc,id"
else
strsql="select top " & pagesize & " id,pname,explain,classid,addtime,sphotopath from productlist where id not in(select top " & m & " id from productlist where pname like '%" & key & "%' and classid=" & classid & " order by isgood desc,pid,addtime desc,id) and pname like '%" & key & "%' and classid=" & classid & " order by isgood desc,pid,addtime desc,id"
End if
End if
set objrs=server.createobject("ADODB.Recordset")
objrs.open strsql,objconn,1,2,1
%>
<%
Dim objrs3,strsql3
strsql3="select * from productclass order by pid"
set objrs3=server.createobject("ADODB.Recordset")
objrs3.open strsql3,objconn,1,2,1
k=1
Do while not objrs3.Eof
%>