分页不管用,哪里错了呀,谁帮忙看看

always82 2008-11-29 11:22:13
代码如下:

<table width="700" border="0" cellpadding="0" cellspacing="0" background="images/mh_bg005.gif">
<tr>
<td width="140">
<%
PageShowSize = 5 '每页显示多少个页
MyPageSize = 10 '每页显示多少条文章

If Not IsNumeric(Request("page")) Or IsEmpty(Request("page")) Or Request("page") <=0 Then
MyPage=1
Else
MyPage=Int(Abs(Request("page")))
End if
set rs=server.createobject("adodb.recordset")
sql="select picname from news where typeid=4 and checkked=1 order by newsID desc"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
%>
<table width="700" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="140"><table width="100" height="130" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee">暂无图片</td>
</tr>
</table></td>
</tr>
</table>
<%
else

rs.PageSize = MyPageSize
MaxPages = rs.PageCount
rs.absolutepage = MyPage
total = rs.RecordCount
i = 1

%>
<table width="700" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="700" border="0" cellpadding="0" cellspacing="0">
<%
for i=1 to rs.recordcount
%>
<tr>
<td width="140" height="166"><div align="center">
<table width="100" height="130" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee"><a href=zbzs_001.asp?id=<%=rs("newsid")%> target=_blank><img src="uploadfile/<%=rs("picname")%>" width="100" height="130" border="0" /></a></td>
</tr>
</table>
</div>
</td>
<%
rs.movenext
if rs.eof then exit for
%>
<td width="140"><div align="center">
<table width="100" height="130" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee"><a href=zbzs_001.asp?id=<%=rs("newsid")%> target=_blank><img src="uploadfile/<%=rs("picname")%>" width="100" height="130" border="0" /></a></td>
</tr>
</table>
</div></td>
<%
rs.movenext
if rs.eof then exit for
%>
<td width="140"><div align="center">
<table width="100" height="130" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee"><a href=zbzs_001.asp?id=<%=rs("newsid")%> target=_blank><img src="uploadfile/<%=rs("picname")%>" width="100" height="130" border="0" /></a></td>
</tr>
</table>
</div></td>
<%
rs.movenext
if rs.eof then exit for
%>
<td width="140"><div align="center">
<table width="100" height="130" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee"><a href=zbzs_001.asp?id=<%=rs("newsid")%> target=_blank><img src="uploadfile/<%=rs("picname")%>" width="100" height="130" border="0" /></a></td>
</tr>
</table>
</div></td>
<%
rs.movenext
if rs.eof then exit for
%>
<td width="140"><div align="center">
<table width="100" height="130" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#eeeeee"><a href=zbzs_001.asp?id=<%=rs("newsid")%> target=_blank><img src="uploadfile/<%=rs("picname")%>" width="100" height="130" border="0" /></a></td>
</tr>
</table>
</div></td>
</tr>
</table>
<%
rs.movenext
if rs.eof then exit for
next
%>
<table width="700" border="0" cellspacing="1" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td bgcolor="#EEEEEE" height="22"><div align="right">共 <%=total%> 条,当前第 <%=Mypage%>/<%=Maxpages%>页,每页 <%=MyPageSize%> 条
<%
url="zbzs.asp?"

PageNextSize=int((MyPage-1)/PageShowSize)+1
Pagetpage=int((total-1)/rs.PageSize)+1


if MyPage-1 > 0 then
Prev_Page = MyPage - 1
Response.write "<a class=black href='" & Url & "page=" & Prev_Page & "' title='第" & Prev_Page & "页'>上一页</a> "
end if

if Maxpages>=PageNextSize*PageShowSize then
PageSizeShow = PageShowSize
Else
PageSizeShow = Maxpages-PageShowSize*(PageNextSize-1)
End if
If PageSizeShow < 1 Then PageSizeShow = 1
for PageCounterSize=1 to PageSizeShow
PageLink = (PageCounterSize+PageNextSize*PageShowSize)-PageShowSize
if PageLink <> MyPage Then
Response.write "<a class=black href='" & Url & "page=" & PageLink & "'>[" & PageLink & "]</a> "
else
Response.Write "<B>["& PageLink &"]</B> "
end if
If PageLink = MaxPages Then Exit for
Next

if Mypage+1 <=Pagetpage then
Next_Page = MyPage + 1
Response.write "<a class=black href='" & Url & "page=" & Next_Page & "' title='第" & Next_Page & "页'>下一页</A>"
end if

if MaxPages > PageShowSize*PageNextSize then
PageNext = PageShowSize * PageNextSize + 1
Response.write " <A class=black href='" & Url & "page=" & Pagetpage & "' title='第"& Pagetpage &"页'>页尾</A>"

End if
%>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
<%
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</td>
</tr>
</table>
...全文
59 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhaohongbo83 2008-11-29
  • 打赏
  • 举报
回复
最好是分段查一下response.write
response.end
看下你的程序对不对
always82 2008-11-29
  • 打赏
  • 举报
回复
可是我这么写到底哪里错了呢
sy_binbin 2008-11-29
  • 打赏
  • 举报
回复
http://blog.csdn.net/sy_binbin/archive/2008/11/15/3306266.aspx

你自己看看吧
toury 2008-11-29
  • 打赏
  • 举报
回复
说多一点,呵呵
if pagesize=empty then pagesize=20
rs.pagesize=pagesize
r=rs.pagecount
rr=rs.RecordCount
page=request("page")
if page="" then page=1 else page=cint(page)
rs.absolutepage=page
for i=1 to rs.PageSize

你把有关的变量换成你自己的
toury 2008-11-29
  • 打赏
  • 举报
回复
for i=1 to rs.recordcount
--------->

for i=1 to rs.PageSize
always82 2008-11-29
  • 打赏
  • 举报
回复
主要是设置了分页,第一页取到的是全部的记录,第二页是正常的,实在不知道哪块出错了,谁能给分析下大概错在哪里呢

28,409

社区成员

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

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