标题:asp分页显示问题?
只看楼主
assnpl
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-11-2
 问题点数:0 回复次数:1 
asp分页显示问题?
为什么第一页把全部的数据多显示出来,不过点击下一页,下一页又显示正常的内容?到底那里错了?

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<%page=request.QueryString("page")
if not isempty(page) then
PageCount=cint(page)
else
PageCount=1
end if
n=1
exec="select * from Products where CID=5 order by ID desc"
set rs=server.CreateObject("adodb.recordset")
rs.PageSize=20
rs.open exec,conn,1,1
filename="motif.asp"
if rs.RecordCount<=0 then
%>
<tr><td class="llpj" height="300" valign="top">暂无相关信息</td></tr>
<% else
rs.AbsolutePage=PageCount
do while not rs.eof
%>
<%For i = 1 to rs.PageSize
if rs.EOF then
Exit For
end if
if (i mod 4)=1 then
%>
<tr><td width="25%">
<table width="160" cellspacing="0" cellpadding="0" border="0" class="mp">
<tr valign="bottom" height="160"><td align="center">
<a href="product_series_content.asp?id=<%=rs("id")%>">
<img src="<%=rs("ProImage")%>" border="0"/></a>
</td></tr></table></td>
<%else
if (i mod 4)=0 then
%>
<td width="25%">
<table width="160" cellspacing="0" cellpadding="0" border="0" class="mp">
<tr valign="bottom" height="160"><td align="center">
<a href="product_series_content.asp?id=<%=rs("id")%>">
<img src="<%=rs("ProImage")%>" border="0"/></a>
</td></tr></table></td></tr>
<tr><td colspan="4"> </td></tr>
<%else%>
<td width="25%">
<table width="160" cellspacing="0" cellpadding="0" border="0" class="mp">
<tr valign="bottom" height="160"><td align="center">
<a href="product_series_content.asp?id=<%=rs("id")%>">
<img src="<%=rs("ProImage")%>" border="0"/></a>
</td></tr></table></td>
<%end if
end if
rs.movenext
next %>
<%
rs.movenext
n=n+1
if n>rs.PageSize then exit do
loop
end if
%>
<tr>
<td style="padding-top:10px;" colspan="4">
<!-- #Include File="Include/SplitPage.Asp" -->
</td></tr>
<%rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</table>

[[it] 本帖最后由 assnpl 于 2008-11-4 11:20 编辑 [/it]]
搜索更多相关主题的帖子: asp 
2008-11-04 11:17
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
那是因为你没把分页查询的条件带到下一页
2008-11-04 11:57



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




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

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