asp的高手们,我又提问了,for循环分页显示记录集的问题?
代码如下:<%@LANGUAGE="VBSCRIPT"CODEPAGE="65001"%><!--#includefile="../Inc/conn.asp"--><!D...
代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Inc/conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>记录集分页显示</title>
</head>
<body>
<%
dim rs,sql
set rs=server.CreateObject("Adodb.Recordset")
sql="select * from zhigong"
rs.open sql,conn,1,1
if request("page")="" then
page=1
elseif request("page")<1 then
page=1
else
page=request("page")
end if
rs.pagesize=3
rs.Absolutepage=page
if rs.RecordCount=0 then
response.Write("没有记录")
else
%>
<%
if rs.eof then
response.Write("没有相关记录")
else
for ipage=1 to rs.pagecount
%>
<%=rs("id")%>
<%=rs("username")%>
<%=rs("gongzi")%>
<%=rs("zhuanye")%>
<%=rs("sheng")%><br />
<%
rs.movenext
if rs.eof then
exit for
next
end if
%>
<br />
共有<%=rs.recordcount%>条记录
当前是第<%=page%>页/共有<%=rs.pagecount%>页
<a href="class.asp?page=1">第一页</a>
<%if page<>1 then%>
<a href="class.asp?page=<%=(page-1)%>">上一页</a>
<%end if%>
<%if page<>rs.pagecount then%>
<a href="class.asp?page=<%=(page+1)%>">下一页</a>
<a href="class.asp?page=<%=rs.pagecount%>">尾页</a>
<%
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>
浏览器报错为第44行 就是next,我看了好久还是看不明白,只有找你们请教了!!! 展开
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Inc/conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>记录集分页显示</title>
</head>
<body>
<%
dim rs,sql
set rs=server.CreateObject("Adodb.Recordset")
sql="select * from zhigong"
rs.open sql,conn,1,1
if request("page")="" then
page=1
elseif request("page")<1 then
page=1
else
page=request("page")
end if
rs.pagesize=3
rs.Absolutepage=page
if rs.RecordCount=0 then
response.Write("没有记录")
else
%>
<%
if rs.eof then
response.Write("没有相关记录")
else
for ipage=1 to rs.pagecount
%>
<%=rs("id")%>
<%=rs("username")%>
<%=rs("gongzi")%>
<%=rs("zhuanye")%>
<%=rs("sheng")%><br />
<%
rs.movenext
if rs.eof then
exit for
next
end if
%>
<br />
共有<%=rs.recordcount%>条记录
当前是第<%=page%>页/共有<%=rs.pagecount%>页
<a href="class.asp?page=1">第一页</a>
<%if page<>1 then%>
<a href="class.asp?page=<%=(page-1)%>">上一页</a>
<%end if%>
<%if page<>rs.pagecount then%>
<a href="class.asp?page=<%=(page+1)%>">下一页</a>
<a href="class.asp?page=<%=rs.pagecount%>">尾页</a>
<%
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>
浏览器报错为第44行 就是next,我看了好久还是看不明白,只有找你们请教了!!! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询