rs.close'问题出在这个rs.close上这句话不应该写在这个位置上
end if
%>
<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>
改后的代码
<%
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.cursortype=3
rs.open sql,conn
on error resume next
If rs.EOF Then
'则关闭记录集
rs.Close
'显示目前还没有评论
Response.Write "此文章暂无评论"
Else
'设置每页记录数
rs.PageSize = PERPAGE
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
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
'这里缺少对最后一条数据的判断
if rs.eof then exit for
next
end if
%>
<br><br>
<p align="center">
<a href="indexrdbeifen.asp?page=1">首页</a>
<%IF Curpage<>1 Then%>
<a href="indexrdbeifen.asp?page=<%=curpage-1%>">前一页</a>
<%Else%>
前一页
<%End IF%>
<%IF CurPage<>rs.pagecount Then%>
<a href="indexrdbeifen.asp?page=<%=curpage+1%>">后一页</a>
<%Else%>
后一页
<%End IF%>
<a href="indexrdbeifen.asp?page=<%=rs.pagecount%>">末页</a>
</p>
<p align="center">现在是第<%=curpage%>页一共有<%=rs.pagecount%>页</p>
<%
rs.close
%>