显示分页的代码,高手帮忙看下哪里错了,谢谢
<%Dim i,rs
PERPAGE = 20
Set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from News,Category where news.CateID=Category.CID and '热点新闻' order by NewsID desc"
rs.open sql,conn,3,2
on error resume next
If rs.EOF Then
'则关闭记录集
rs.Close
'显示目前还没有评论
Response.Write "此文章暂无评论"
Else
'设置每页记录数
rs.PageSize = PERPAGE
'设置当前页码
rs.AbsolutePage = CurPage
For i = 1 To rs.PageSize
Response.Write "<a class='style34' onClick='return newwin(this.href);' href='newsView.asp?id=" + cstr(rs("newsid")) + "'>" + rs("newsTitle") +"</p>"
rs.movenext
next
rs.close
end if
if request("page")<>"" then
curpage=cint(request("page"))
if curpage<1 then curpage=1
if curpage>rs.pagecount then curpage=rs.pagecount
else
curpage=1
end if
rs.absolutepage=curpage
%>
<br><br>
<p align="center">
<a href="indexrdbeifen.asp?page=1">首页</a>
<a href="indexrdbeifen.asp?page=<%=curpage-1%>">前一页</a>
<a href="indexrdbeifen.asp?page=<%=curpage+1%>">后一页</a>
<a href="indexrdbeifen.asp?page=<%=rs.pagecount%>">末页</a>
</p>
<p align="center">现在是第<%=curpage%>页一共有<%=rs.pagecount%>页</p>