大家看看我这分页代码有没有出错?
<%@LANGUAGE= "VBSCRIPT " CODEPAGE= "936 "%>
<!--#include file= "conn.asp "-->
<%
set rs=server.createobject( "adodb.recordset ") '使用记录集组件创建记录集
cx= "select name,qq,email,ly,time from liuyan order by id desc " '建立查询变量,查询表中的字段,顺序为倒序,即反顺序,此处不能有空格
rs.open cx,conn,1,1 '打开记录集,进行读取
%>
<%rs.pagesize=3 '使用recordset记录中的pagesize(页面显示的记录数)属性来确定每页显示几条记录
suoyouye=rs.pagecount '查询记录集中的页数
page=int(request( "page ")) '将PAGE变量 转换为整数
if page <=0 then page=1 '如果页数等于小于零那么设定此页等于1
if request( "page ")= " " then page=1 '如果页数等于空,那么仍旧蛇定此页等于1
rs.absolutepage=page '指定当前记录在哪一页。pagesize、pagecount、absolutpage均为recordset的属性
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 无标题文档 </title>
<style type= "text/css ">
<!--
.style1 {font-size: 12px}
.style2 {
font-size: 14px;
color: #FF0000;
}
-->
</style>
</head>
<body>
<%if rs.eof and rs.bof then
response.write "还没有文章 "
else
for i=1 to rs.pagesize%>
<div align= "center ">
<table width= "543 " height= "80 " border= "1 " cellpadding= "0 " cellspacing= "0 " bordercolor= "#006633 ">
<tr>
<td width= "369 " height= "23 "> <table width= "369 " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td height= "23 " bgcolor= "#00CCCC "> <div align= "left "> <span class= "style1 "> 留言人 </span> :
<%response.write rs( "name ")%>
<span class= "style1 "> 留言时间 </span> :
<%response.write rs( "time ")%>
</div> </td>
</tr>
</table> </td>
<td width= "84 "> <table width= "84 " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td height= "23 " bgcolor= "#009966 "> <div align= "center "> <a href= "http://search.tencent.com/cgi-bin/friend/user_show_info?ln= <%=rs( "qq ")%> " target= "_blank " class= "style1 "> QQ </a> </div> </td>
</tr>
</table> </td>
<td width= "91 "> <table width= "84 " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td height= "23 " bgcolor= "#009966 "> <div align= "center ">
<a href= "mailto: <%=rs( "email ")%> %20 " target= "_blank " class= "style1 "> 邮件 </a> </div> </td>
</tr>
</table> </td>
</tr>
<tr>
<td height= "21 " colspan= "3 "> <span class= "style2 "> 内容 </span> :
<%response.write rs( "ly ")%> </td>
</tr>
<tr>
<td height= "17 " colspan= "3 "> </td>
</tr>
<br>
<%
rs.movenext
next
end if
%>
<tr>
<td height= "15 "> </td>
<td bgcolor= "#009966 "> <div align= "center "> <a href= "liyan.asp " class= "style1 "> 填写留言 </a> </div> </td>
<td bgcolor= "#009966 "> <div align= "center "> <a href= "admin.asp " target= "_blank " class= "style1 "> 管理留言 </a> </div> </td>
</tr>
</table>
<%if page=1 and not page=suoyouye then%>
第一页|上一页|
<a href= "index.asp?page= <%=page+1%> "> 下一页 </a> |
<a href= "index.asp?page= <%=suoyouye%> "> 最后一页 </a> |
<%elseif page <> 1 and not page=suoyouye then%>
<a href= "index.asp?page=1 "> 第一页 </a> |
<a href= "index.asp?page= <%=page-1%> "> 上一页 </a> |
<a href= "index.asp?page= <%=page+1%> "> 下一页 </a> |
<a href= "index.asp?page= <%=suoyouye%> "> 最后一页 </a> |
<%elseif page=suoyouye then%>
<a href= "index.asp?page=1 "> 第一页 </a> |
<a href= "index.asp?page= <%=page-1%> "> 上一页 </a> |
下一页|
最后一页
<% End if %>
<br>
</div>
</body>
</html>
我没什么分数了,给少了,大家见谅,希望尽量帮帮我,初学ASP
当我点到最后一页的时候,就会出现,一个错误,如下:
错误类型:
ADODB.Field (0x80020009)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/自己做的留言本/index.asp
[解决办法]
<%
rs.movenext
_______________________________在下面加上这句话就可以拉__________________________
if rs.eof then exit for
________________________________________________________________________________
next
end if
%>