大侠帮忙!!!界面正常,分页不成功,只能显示一页,

handuson 2006-06-30 02:55:25
以下是代码,总页数出不来。显示“共有-1页”后面是“共-2页” 首页和前页的连接都是灰色的,
我用的是MYSQL数据库。
<table width="96%"cellpadding="2" cellspacing="1" border="1" bordercolor="#808080" bordercolordark="#ffffff" bordercolorlight="#e1f5ff">
<tr valign="top">
<td width="20%" align="center" bgcolor="#e1f5ff"><strong>软件序列号</strong></td>
<td width="20%" align="center" bgcolor="#e1f5ff"><b>结束时间</b></td>
<td width="20%" align="center" bgcolor="#e1f5ff"><b>开始时间</b></td>
<td width="20%" align="center" bgcolor="#e1f5ff"><b>工程师ID</b></td>
<td width="20%" align="center" bgcolor="#e1f5ff"><b>评分</b></td>
</tr>
<%

set rs=Server.CreateObject("ADODB.Recordset")
rs.OPen "Select * from VPNuser",conn,1,3

if rs.Eof and Bof then
Response.Write "目前没有记录!"
else
Counts=5
'rs.PageSize =counts
allPages=rs.recordcount/5
if allpages*5<rs.recordcount then allpages=allpages+1
page=Request("page")
if not isNumeric(Page) then Page=1
if Page=0 or page<1 then
page=1
elseif page>=allPages then
page=allPages
end if
rs.move counts*(page-1)
Do While(Not rs.Eof) and counts>0
%>
<tr>
<td valign="top"><%=rs("registrationnumber")%></td>
<td><%=rs("EndProcessTime")%></td>
<td><%=rs("StartProcessTime")%></td>
<td><%=rs("EngineerID")%></td>
<td><%=rs("score")%></td>
</tr>
<%
counts=counts-1
rs.movenext
if rs.eof then exit do
loop
end if
%>
</table>
<table align="center">
<tr>
<td height="50" valign="top" align="center">
<%
response.Write "<br>     当前共有"&rs.recordCount&"条查询记录"
if Page=1 then
Response.Write "<font color=darkgray>首页 前页</font>"
else
'调用页面自己以显示上下页
Response.Write "<a href=chaxun0.asp?page=1>首页</a><a href=chaxun0.asp?page="&page-1&">前页</a>"
End if
if page=allpages then
response.Write "<font color=darkgray> 下页 末页</font>"
else
response.Write "<a href=chaxun0.asp?page="&page+1&">下页</a><a href=chaxun0.asp?page="&allpages&">末页</a>"
End if
response.Write "第"&page&"页 共"&allpages&"页"

%>
</td>
</tr>
</table>
...全文
136 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
handuson 2006-07-03
  • 打赏
  • 举报
回复
谢谢小玲子提示语句错误,不过这个问题不在这.

gzxlq()所说的那个注释 是我注释掉的,不注释掉就会提示书签错误.

永恒的瞬间 所说的  我不太清楚应该具体怎么加,麻烦说具体一下  谢谢.

george19810411所说的意思同上
minmin127 2006-07-03
  • 打赏
  • 举报
回复
给你参考一段分页代码:

dim currentPage '定义当前页数
dim myPageSize '定义每页显示记录数目
currentPage = Request.QueryString("currentPage")
if currentPage = "" then currentPage = 1 end if
myPageSize = Request.QueryString("myPageSize")
if myPageSize = "" then
myPageSize = Application("myPageSize")
end if

rs.open strSQL,conn,3,2,1
'Response.Write(rs.Absolutepage)
if not(rs.Eof or rs.Bof) then
rs.MoveFirst
dim maxPageCount '定义总页数
rs.PageSize = myPageSize
maxPageCount = CInt(rs.PageCount)
rs.AbsolutePage = currentPage
dim recordNum '定义查询到的总记录数
recordNum = 0
读rs中字段内容的时候:
<%
Do while not rs.Eof and recordNum < rs.PageSize
%>
<tr>
<td><%=rs("StartTime")%></td>
</tr>
<%
rs.MoveNext()
recordNum = recordNum + 1
loop
%>
jingxiaoping 2006-06-30
  • 打赏
  • 举报
回复
if rs.Eof and Bof then
这句明显错误。
george19810411 2006-06-30
  • 打赏
  • 举报
回复
page=Request("page")
你应该在你的asp中hidden一个page
你没有hidden
如何取得这个翻页的值
gzxlq 2006-06-30
  • 打赏
  • 举报
回复
'rs.PageSize =counts这希怎么会一个“'”注释符
你好像没有指南当前页吧
weiang_1983 2006-06-30
  • 打赏
  • 举报
回复
Currentpage=request("page")

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧