ASP分页有点小问题。请高手帮忙解决一下!
<!--#includefile="logo.asp"--><%exec="select*fromuers"setrs=server.createobject("adod...
<!--#include file="logo.asp" -->
<%
exec="select * from uers "
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<%
rs.pagesize=3
fy=rs.pagecount
page=int(request("page"))
if page<=0 then page=1
if request("page")="" then page=1
rs.absolutepage=page
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="219" height="37">
<tr>
<td width="217" height="37"><font SIZE="5" COLOR="#FFFFFF">
</font>
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<%if rs.eof and rs.bof then
response.write("暂时没有资料")
else
for i=1 to rs.pagesize
if not rs.eof then
%>
<center>
<table border="1" cellpadding="0" cellspacing="0" width="464" height="211" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" bordercolor="#C0C0C0">
<tr>
<td width="180" height="211" rowspan="2"><img src="<%=rs("zp")%>" width="180" height="211"></td>
<td width="65" height="34">
<p align="center"><font face="宋体" size="3" color="#FF0000">姓名</font></td>
<td width="82" height="34"><font face="宋体" size="3" color="#FFFFFF"><%=rs("name")%></font></td>
</center>
<td width="66" height="34">
<p align="center"><font face="宋体" size="3" color="#FF0000">工号</font></td>
<center>
<td width="69" height="34"><font face="宋体" size="3" color="#FFFFFF"><%=rs("gh")%></font></td>
</tr>
<tr>
<td width="284" height="177" colspan="4">
<font face="宋体" size="3" color="#FFFFFF"><p style="text-indent: 12; line-height: 150%; margin-left: 3; margin-right: 3"><%=rs("rsgy")%></font></td>
</tr>
</table>
</center>
<p>
<p>
<p>
<%rs.movenext%>
<%end if%>
<%next%>
<%end if%>
<p>
<p>
<p>
<%for i=1 to fy%>
<a href="ygjs.asp?page=<%=i%>"><%=i%></a>
<%next%>
</div>
</body>
</html>
这是我的代码。他为什么总是少显示一张啊!
高手帮忙看看 展开
<%
exec="select * from uers "
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<%
rs.pagesize=3
fy=rs.pagecount
page=int(request("page"))
if page<=0 then page=1
if request("page")="" then page=1
rs.absolutepage=page
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="219" height="37">
<tr>
<td width="217" height="37"><font SIZE="5" COLOR="#FFFFFF">
</font>
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<%if rs.eof and rs.bof then
response.write("暂时没有资料")
else
for i=1 to rs.pagesize
if not rs.eof then
%>
<center>
<table border="1" cellpadding="0" cellspacing="0" width="464" height="211" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" bordercolor="#C0C0C0">
<tr>
<td width="180" height="211" rowspan="2"><img src="<%=rs("zp")%>" width="180" height="211"></td>
<td width="65" height="34">
<p align="center"><font face="宋体" size="3" color="#FF0000">姓名</font></td>
<td width="82" height="34"><font face="宋体" size="3" color="#FFFFFF"><%=rs("name")%></font></td>
</center>
<td width="66" height="34">
<p align="center"><font face="宋体" size="3" color="#FF0000">工号</font></td>
<center>
<td width="69" height="34"><font face="宋体" size="3" color="#FFFFFF"><%=rs("gh")%></font></td>
</tr>
<tr>
<td width="284" height="177" colspan="4">
<font face="宋体" size="3" color="#FFFFFF"><p style="text-indent: 12; line-height: 150%; margin-left: 3; margin-right: 3"><%=rs("rsgy")%></font></td>
</tr>
</table>
</center>
<p>
<p>
<p>
<%rs.movenext%>
<%end if%>
<%next%>
<%end if%>
<p>
<p>
<p>
<%for i=1 to fy%>
<a href="ygjs.asp?page=<%=i%>"><%=i%></a>
<%next%>
</div>
</body>
</html>
这是我的代码。他为什么总是少显示一张啊!
高手帮忙看看 展开
4个回答
展开全部
少显示了第一页吧?
把for i=1 to rs.pagesize
改成
for i=0 to rs.pagesize
把for i=1 to rs.pagesize
改成
for i=0 to rs.pagesize
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用do loop循环比较好 ,因为用for i=0 to rs.pagesize 到了最后一页,如果没有rs.pagesize这么多条记录就会输出几行空值;
for i=1 to rs.pagesize
if not rs.eof then
改成
i=0:do while not rs.eof:i=i+1
<%rs.movenext%>
<%end if%>
<%next%>
改为
if i>=rs.pagesize then exit do
rs.movenext:loop
for i=1 to rs.pagesize
if not rs.eof then
改成
i=0:do while not rs.eof:i=i+1
<%rs.movenext%>
<%end if%>
<%next%>
改为
if i>=rs.pagesize then exit do
rs.movenext:loop
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
少了那页?说清楚点
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询