标题:求助分页问题,第二页无法显示??急??
只看楼主
hydtk
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-5-30
 问题点数:0 回复次数:3 
求助分页问题,第二页无法显示??急??

以下是我分页显示的原代码,可第一页正常显示了,第二页就空白了,出不来,怎么回事呀!请高手指点以下,说明具体的改法,谢谢了!!!
--------------------------------------------------

<!--#include file="weconnsn.asp"-->

<%

set rs = server.createobject("adodb.recordset")
sqlstr = "select * from wbda"
rs.Open sqlstr, db, 1, 1

pages = request.querystring("pages") '获得提交过来要显示的页数

if pages = "" then '当提交过来的页数为空,或页数小于1时,将页数置为1
pages = 1
end if
if pages <> "" and cint(pages) < 1 then
pages = 1
end if

pagesize = 5 '设置每页显示的记录数
rs.PageSize = pagesize
rs.CacheSize = pagesize

pagecount = rs.PageCount

if cint(pages) > pagecount then '如果提交过来的页数超过总页数,将页数置为最大页数
pages = pagecount
end if
rs.AbsolutePage = pages '设置当前的页数

' dim i
' i=(pages-1)*pagesize
'do while not rs.eof and i < pagesize+(pages-1)*pagesize
' i=i + 1
%>
<html>
<head>
<link href="/style.css" rel="stylesheet" type="text/css">
<title>举报</title>
<style type="text/css">
<!--
.STYLE1 {
color: #000099;
font-weight: bold;
}
-->
</style>
<script language="JavaScript" fptype="dynamicanimation">
<!--
function dynAnimation() {}
function clickSwapImg() {}
//-->
</script>
</head>
<BODY background=#ffffff>
<CENTER>
<a name="top"></a> <a name="add"></a>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td> <table width="715" border="0" align="center" cellpadding="0" cellspacing="0" height="806">
<tr>
<td width="30"> </td>
<td width="652" valign="top">
<TABLE
width="94%" border=0 align="center" cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD width="549" align="center">
<%
if rs.eof and rs.bof then
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="17%" valign="bottom"> <div align="center"><strong><font color="#333333">举报公告:</font></strong>
</div></td>

</tr>
</table>
<table width="75%" border="0" align="center" cellpadding="6" >
<tr>
<td height="48" align="center"> <p>还没有任何举报!</p></td>
</tr>
</table>
<%else%>
<div align="center">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right"><table width="100%" border="0">
<tr>
<td width="17%" valign="bottom">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><font color="#000000">&nbsp; </font></td>
</tr>
<tr>
<td align="center">
<%
dim i
i=(pages-1)*pagesize
while not rs.eof and i < pagesize+(pages-1)*pagesize
i=i + 1

'do while not rs.eof and e_page>0
%>
<TABLE class=log_td_table cellSpacing=0 cellPadding=0
width="100%" border=0>
<TBODY>
<TR> </TR>
<TR>
<TD class=log_text_box
style="TABLE-LAYOUT: fixed; WORD-BREAK: break-all"
vAlign=top> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="bottom">第<%=rs("id")%>位 </td>
<td></td>
<td width="459" align="left" valign="middle">&nbsp;&nbsp;&nbsp;<font color="#000099">举报日期:</font><font color="#666666"><%=rs("tytime")%></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td width="1" align="right" valign="middle"></td>
</tr>
<tr>
<td height="16" align="center" valign="bottom">&nbsp;</td>
<td></td>
<td align="left" valign="middle">&nbsp;&nbsp;&nbsp;<font color="#000099">联系电话:</font><font color="#666666"><%=rs("telrew")%></font></td>
<td align="right" valign="middle"></td>
</tr>
<tr>
<td height="17" align="center" valign="bottom">&nbsp;</td>
<td></td>
<td align="left" valign="middle">&nbsp;<font color="#666666"> &nbsp;<font color="#000099">IP地址:</font><font color="#666666"><%=rs("ipweb")%></font></font></td>
<td align="right" valign="middle"></td>
</tr>
<tr>
<td width="70" rowspan="4" align="center" valign="top"><p> <br>
<br>
</p>
<p><strong><b><%=rs("name")%></b></strong>
<br>
<br>
<%if session("admin")="smallstick" then%>
<br>
[<a href="print.asp?id=<%=rs("weid")%>">打印</a>]<br>
[<a href="del.asp?id=<%=rs("weid")%>" onClick="return confirm('您确定进行删除操作吗?')">删除</a>]
<%end if%>
</p></td>
<td height="17"></td>
<td align="left" valign="middle">&nbsp;&nbsp;</td>
<td align="right" valign="middle"></td>
</tr>
<tr>
<td height="18"></td>
<td align="left" valign="middle">&nbsp;&nbsp;
<div align="center"></div></td>
<td align="right" valign="middle"></td>
</tr>
<tr>
<td width="1" rowspan="2" background="/img/bg_1.gif"></td>
</tr>
<tr>
<td align="center" valign="middle" bgcolor="#F5F5F5">
<table width="95%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F5F5F5" style="table-layout:fixed;word-break:break-all">
<tr>
<td height="100%"><font color="#ff0000"> 举报对象</font>

<%=rs("jewbdx")%><br><br> <font color="#333333">&nbsp;

</font><br><br>
<font color="#0000ff"> 举报内容:</font><p><%=ubbcode(HTMLEncode(rs("yfjblr")))%>



</p></td>
</tr>
</table></td>
<td width="1" background="/img/bg_1.gif"></td>
</tr>
</table></TD>
</TR>
</TBODY>
</TABLE>
<br>
<%
'e_page=e_page-1
'rs.movenext
'loop
rs.movenext
wend
' loop

%>
</td>
</tr>
<tr>
<td>
<div align="right"> <%
set rs = server.createobject("adodb.recordset")
sqlstr = "select * from wbda"
rs.Open sqlstr, db, 1, 1
if (pages-1)*pagesize<>0 then
%>
<a href="disp.asp?pages=<%=pages-1%>">上一页</a>
<%
end if
if rs.RecordCount>(pages)*pagesize then
%>
<a href="disp.asp?pages=<%=pages+1%>">下一页</a>


<%end if%> </div></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"> </td>
</tr>
</table>
</div></TD>
</TR>
</TBODY>
</TABLE>
<%
rs.close
'set rs=nothing

end if
%>
</td>
</tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center bgColor=#ffffff
border=0>
<TBODY>
<TR>
<TD align=middle height=16><BR>
<DIV align=center></DIV>
<DIV align=center></DIV></TD></TR></TBODY></TABLE>
-----------------------------------
以上是我分页显示的原代码,可第一页正常显示了,第二页就空白了,出不来,怎么回事呀!请高手指点以下,说明具体的改法,谢谢了!!!

[此贴子已经被作者于2006-5-30 10:00:47编辑过]

搜索更多相关主题的帖子: include pages 
2006-05-30 10:00
小聪
Rank: 1
等 级:新手上路
帖 子:57
专家分:0
注 册:2006-3-31
得分:0 
<html>
<head>
<title>图片分页</title>
<meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
</head>
<body>
<table align="center">
<tr>
<%
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open "select * from product",conn,1,1
counts=6
rs.pageSize = counts '每页记录数
allpages = rs.pageCount '总页数
page = Request("page") '从浏览器取得当前页
If not isNumeric(page) then page=1 'page不是数字
if isEmpty(page) or Cint(page) < 1 then 'page 为空或小于1
page = 1
elseif Cint(page) >= allPages then 'page 值大于总页数
page = allPages
end if
rs.AbsolutePage = page '转到某页头部
tempnum=1
do while not rs.eof and counts>0
%>
<td><img src="productimage/<%=rs("smallimg")%>"></td>
<%
if (tempnum mod 3)=0 then response.write "</tr>" '五列显示mod 5
tempnum=tempnum+1
counts = counts - 1
if rs.eof then exit do
rs.movenext
loop
%></table><table align="center"><tr><td>
<%
'显示总留言条数
response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;总计留言"&RS.RecordCount&"条 "
if page = 1 then '到达第一页
response.write "<font color=darkgray>首页 &nbsp;上页</font>"
else '不是第一页
response.write "<a href="&request.ServerVariables("script_name")&"?page=1>首页</a>&nbsp;<a href="&request.ServerVariables("script_name")&"?page="&page-1&">上页</a>"
end if
if page = allpages then '到达最后一页
response.write "<font color=darkgray> 下页&nbsp; 末页</font>"
else '不是最后一页
'建立超级链接
response.write " <a href="&request.ServerVariables("script_name")&"?page="&page+1&">下页</a>&nbsp; <a href="&request.ServerVariables("script_name")&"?page="&allpages&">末页</a>"
end if
'显示留言当前的页数信息
response.write " 第"&page&"页 共"&allpages&"页 "
%></td></tr>
</table>
</body>
</html>

2006-05-30 10:21
icecool
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:20
帖 子:1214
专家分:1366
注 册:2005-3-14
得分:0 

[QUOTE]
set rs = server.createobject("adodb.recordset")
sqlstr = "select * from wbda"
rs.Open sqlstr, db, 1, 1

pages = request.querystring("pages") '获得提交过来要显示的页数

if pages = "" then '当提交过来的页数为空,或页数小于1时,将页数置为1
pages = 1
end if
if pages <> "" and cint(pages) < 1 then
pages = 1
end if

pagesize = 5 '设置每页显示的记录数
rs.PageSize = pagesize
rs.CacheSize = pagesize

[/QUOTE]


rs.pagesize必须在查询前设置才能有用的!


http://toorup.3v.do
loading...
2006-05-30 10:32
ko22223
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-5-30
得分:0 

你那个问题只要在<a href="disp.asp?pages=<%=pages-1%>">上一页</a>
<a href="disp.asp?pages=<%=pages+1%>">下一页</a>这两句改一下就行了,把你要传送的参数加上.如:<a href="disp.asp?pages=<%=pages+1%>+"&xxxxxx&"">,我不知道你要传送那写参数所以不能帮你该了.

2006-05-30 14:42



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-68439-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.547165 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved