我按教程写了一个分页程序,可就是提示错误:
<!--#include file="conn.asp"-->
<%
sql="select*from liuyan order by id desc"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
%>
<%
rs.pagesize=2
pagecount=rs.pagecount
page=int(request("page"))
if page<=0 then page=1
if request("page")="" then page=1
rs.absolutepage=page
%>
<!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 {
color: #FF0000;
font-weight: bold;
}
-->
</style>
</head>
<body>
<p align="center" class="style1">留言版</p>
<div align="center">
<table width="600">
<tr>
<td><div align="center">
</div></td>
</tr>
</table>
<table width="600">
<tr>
<td height="15"><div align="right"><a href="add.asp">填写留言</a> <a href="admin.asp">管理留言</a></div></td>
</tr>
</table><%if rs.eof and rs.bof then
response.write("暂且无记录")
else
%>
<%for i=1 to rs.pagesize%>
<table width="600" cellspacing="1" bgcolor="#CCFFCC">
<tr>
<td width="80" height="25"><div align="center"><%=rs("username")%></div></td>
<td width="73" height="25"><div align="left">留言于:</div></td>
<td width="318" height="25"><div align="left"><%=rs("time")%></div></td>
<td width="53" height="25"><div align="center"></div></td>
<td width="58" height="25"><div align="center"></div></td>
</tr>
<tr>
<td height="25" bgcolor="#FFFFFF"><div align="center">内容:</div></td>
<td height="25" colspan="4" bgcolor="#FFFFFF"><div align="left"><%=rs("content")%> </div></td>
</tr>
<table>
<td></td>
</table>
</table>
<table width="600">
<tr>
<td><div align="right"></div></td>
</tr>
</table>
<%rs.movenext
next
end if
%>
<% for i=1 to pagecount %>
<a href="index.asp?page=<%=i%>"><%=i%></a>
<%next%>
<p> </p>
<p> </p>
</div>
</body>
</html>
到最后一页时就提示:
错误类型:
ADODB.Field (0x80020009)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/index.asp