asp网页高手进来,关于搜索结果分页的问题

来源:百度知道 编辑:UC知道 时间:2024/06/07 09:34:41
处理搜索结果的代码:
<%
bt="%"&request("sous")&"%"
if request("hcgood")<>"" then session("hcgood")=request("hcgood")
sql = "select * from shuju where bt like '"&bt&"' and cs='0771' order by gx2 desc"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
if rs.recordcount=0 then
response.write "<br> 共找到<font color=#ff0000> 0 </font>条您所需要的信息!"
response.end
end if
page=int(request.QueryString ("page"))
rs.PageSize=40
pagecount=rs.pagesize
if page<=0 then page=1
if request.QueryString("page")="" then page=1
rs.AbsolutePage=page
gg=rs.recordcount/pagecount
gh=int(gg)
if gh<=1 then gh=1
if gg>gh then gh=gh+1
gg=gh
%>

意思是每页只显示40条,超过40条后用到分页技术,可是我不会写代码,请高手给搞搞

?page改成&page

<a href='jieguo.asp?sous=<%=request("sous")%>&page=<%=page+1%>'>下一页</a>

注意防注入

sous=<%=request("sous")%>

给你改了半天 你运行还有什么错误,你里面少了很多end if,asp 有一个if 就要有一个end if
<%
bt=request("sous")
if request("hcgood")<>"" then session("hcgood")=request("hcgood")
sql = "select * from shuju where bt like '"&bt&"' and cs='0771' order by gx2 desc"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
if rs.recordcount=0 then
response.write "<br> 共找到<font color=#ff0000> 0 </font>条您所需要的信息!"
response.end
end if
end if
page=cint(request.QueryString ("page"))
rs.PageSize=40
pagecount=rs.pagesize
if page<=0 then page=1
end if
if request.QueryString("page"