求助:一段asp翻页代码错误,实在找不出错在哪里了
在网上找了很久类似这样的代码,也找不到原因,请高手帮忙耐心解决。感激不尽。
这种代码和我原来碰到过的不一样,情况是不显示翻页,数据库调用倒是没错。
<%
set rs=server.createobject("adodb.recordset")
sql="select * from news where mytype="&tp&" order by id desc"
rs.open sql,conn,1
rs.pagesize=25'每页显示多少条
pagecount=rs.pagecount '总页数
if rs.bof and rs.eof then
response.write ""
else
page=clng(request.querystring("page"))
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
rs.absolutepage=page '跳到多少页
for i=1 to rs.pagesize
%>
<tr>
<td width="84%" height="32" align="left" bgcolor="<% If i mod 2=0 Then %>#F4F9FC<% Else %>#ffffff<% End If %>"> <font color="#2D5D7D">·</font> <a href="show.asp?id=<%=rs("id")%>" target="_blank"><span style="font-size:14px;"><%=left(rs("bt"),34)%></span></a></td>
<td width="16%" align="center" bgcolor="<% If i mod 2=0 Then %>#F4F9FC<% Else %>#ffffff<% End If %>"><a href="show.asp?id=<%=rs("id")%>" target="_blank"><span style="font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#999999;">(<%= rs("riqi") %>)</span></a></td>
</tr>
<%
rs.movenext
if rs.eof then exit for
next
end if
%>
</table>
<table width="95%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="22" align="center">
<span style="color:#666666">[共<%=rs.pagecount%>页 当前第<%=page%>页 <%
if page<=1 then
Response.Write("首页 ")
Response.Write ("上一页")
else
Response.Write("<a href='?tp="&tp&"&Page=1' class='list'>首页</a> ")
Response.Write("<a href='?tp="&tp&"&Page=" & (Page-1) & "' class='list'>上一页</a>")
end if
response.write " "
if page>=Rs.PageCount then
Response.Write ("")
Response.Write(" ")
else
Response.Write("<a href='?tp="&tp&"&Page=" & (Page+1) & "' class='list'></a>")
Response.Write(" <a href='?tp="&tp&"&Page=" & rs.pagecount & "' class='list'></a>")
end if
%>]