| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 328 人关注过本帖
标题:我这个分页出错了(今天才发现有问题)
只看楼主 加入收藏
依隅
Rank: 1
等 级:新手上路
帖 子:73
专家分:0
注 册:2005-10-17
收藏
 问题点数:0 回复次数:0 
我这个分页出错了(今天才发现有问题)

大家帮看一下我这个分页,今天怎么才发现有问题呀,就是说,他第一页总是显示全部记录呀?
我想主要是蓝色那一块出了问题了,可怎么看也不行呀

<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from bbs order by hfdate desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
%>
对不起,目前还没有此类信息!
<%
else
dim maxperpage
dim sql
dim r
dim gstbookid
dim totalput
dim currentpage
dim totalpages
filename="bbs.asp"
if not isempty(request("page")) then
currentpage=cint(request("page"))
else
currentpage=1
end if
rs.pagesize=3
totalput=rs.recordcount
totalpage=rs.pagecount
maxperpage=rs.pagesize
if currentpage<1 then
currentpage=1
end if
if currentpage>totalpage then
currentpage=totalpage
end if
if currentpage=1 then
showcontent
showpages1
else
if (currentpage-1)*maxperpage<totalput then
rs.move (currentpage-1)*maxperpage
dim bookmark
bookmark=rs.bookmark
showcontent
showpages1
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
%>
</div>
<%
sub showcontent
dim i,j

%>

<table width="760" height="27" border="0" align="center" cellpadding="0" cellspacing="0" background="img4/bg1_r1_c1.gif">
<tr>
<td width="33"><div align="center" class="zz style2">状态</div></td>
<td width="314">&nbsp; <span class="style3">主 题</span></td>
<td width="76"><div align="center" class="style3">作 者</div></td>
<td width="68"><div align="center" class="style3">发布时间</div></td>
<td width="39"><div align="center" class="style3">回复</div></td>
<td width="40"><div align="center" class="style3">人气</div></td>
<td width="190"><div align="center" class="style3">最后更新时间</div></td>
</tr>
</table>
<table width="760" height="30" border="0" align="center" cellpadding="0" cellspacing="0" background="images2/bj.gif" bgcolor="#FFFFFF">
<%
i=1
do while not (rs.eof or err)
%>
<tr>
<td width="33" height="30" align="center" valign="middle" bgcolor="#F4FAFB" class="b3"><%if rs("hfdate") = "2006-10-8" then%><img src="img2/ztop.gif" width="16" height="16"><%else%><img src="img4/folder.gif" width="16" height="16"><%end if%></td>
<td width="314" align="center" valign="middle" class="b2"><div align="left">&nbsp;<a href="new.asp?id=<%=rs("id")%>&zd=<%=rs("hfdate")%>"><%if rs("hfdate")= "2006-10-8" then%><font color="#FF0000"><%=left(rs("bt"),20)%></font><%else%><%=left(rs("bt"),20)%><%end if%></a></div></td>
<td width="76" align="center" valign="middle" bgcolor="#F4FAFB" class="b2"><%=rs("username")%></td>
<td width="69" align="center" valign="middle" class="b2"><%=rs("date")%></td>
<td width="38" align="center" valign="middle" bgcolor="#F4FAFB" class="b2"><%=rs("hfrs")%></td>
<td width="42" align="center" valign="middle" class="b2"><div align="center"><%=rs("rq")%></div></td>
<td width="188" align="center" valign="middle" bgcolor="#F4FAFB" class="b2"><div align="right"><%=rs("hfname")%> <span class="style1">|</span> <%if rs("hfdate")="2006-10-8" then%><%=rs("now")%><%else%><%=rs("hfdate")%><%end if%>&nbsp;</div></td>
</tr>
<%
if i>= maxprepage then exit do
i=i+1
rs.movenext
loop
%>
</table>
<%
end sub
%>
<%
sub showpages1()
dim n
n=totalpage
%>

<table width="760" height="30" border="0" align="center" cellpadding="0" cellspacing="0" background="images2/bj.gif" bgcolor="#FFFFFF" style="border-collapse:collapse">
<form action="<%=filename%>" method="post" align="right">
<tr>
<td width="238" height="30"></td>
<td width="522"><div align="right"><span style="font-size:12px">共<font color="#ff0000"><%=totalpage%></font>页/<font color="red"> <%=totalput%></font> 条信息</span>
<% if currentpage <> 1 then %>
<a href=<%=filename%>><font color="#ff6600"><span style="font-size:12px">【首页】</span></font></a>&nbsp;<a href=<%=filename%>?page=<%=(currentpage-1)%>><font color="#ff6600"><span style="font-size:12px">【上一页】</span></font></a>
<%end if%>
<%if currentpage <> rs.pagecount then%>
<a href=<%=filename%>?page=<%=(currentpage+1)%>><font color="#ff6600"> <span style="font-size:12px">【下一页】</span></font></a>
<%end if%>
<span style="font-size:12px">第<font color="#ff6600"><%=currentpage%></font>页/共<font color="ff6600"><%=totalpage%></font>页
<%
response.write "转到:<select name='page' size=1 class=smallselsect style='font-family:宋体;font-size:12px;'>"
for i=1 to n
response.write"<option value="& i
if currentpage=i then
response.write " selected "
end if
response.write ">"& i &"</option>"
next
response.write "</select>"
response.write"<input name='types' type='hidden' value='"&request("types")&"'>"
response.write "&nbsp;<input class=buttonface type='submit' value='go' style='font-family: 宋体; font-size: 12px;'>"
%>
</span></div></td>
</tr>
</form>
</table>

<%end sub%>
</td>
</tr>
</table>

[此贴子已经被作者于2006-7-10 8:40:45编辑过]

2006-07-10 08:39
快速回复:我这个分页出错了(今天才发现有问题)
数据加载中...
 
   



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

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