大家帮看一下我这个分页,今天怎么才发现有问题呀,就是说,他第一页总是显示全部记录呀?
我想主要是蓝色那一块出了问题了,可怎么看也不行呀
<%
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"> <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"> <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%> </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> <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 " <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编辑过]