[求助]记录在两列八行表格输出后分页出现异常
<!--#include file="database.asp"-->
<HTML><HEAD><TITLE>aa</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
</HEAD>
<BODY leftMargin=0 topMargin=0>
<%
dim rstemp, sqli
set rstemp = server.createobject("adodb.recordset")
%>
<TABLE cellSpacing=0 cellPadding=0 width=580 align=center border=0>
<TR vAlign=bottom>
<TD colSpan=3></TD></TR>
<TR>
<TD> </TD>
<TD width=531 align="center" valign="top">
<P class=bodytitle align=center><BR> </P>
<TABLE cellSpacing=0 cellPadding=0 width="90%" border=0>
<TR>
<TD vAlign=top>
<%
Session("law")=Request("law")
law=Session("law")
Session("title")=Request("title")
title=Session("title")
%>
<br><br>
<font color="#FF0000"><%=title%></font><br>
<hr size="1" noshade>
<%
mypage=request.querystring("whichpage")
If mypage="" then
mypage=1
End If
mypagesize=request.querystring("pagesize")
If mypagesize="" then
mypagesize=8 '设条数
End If
set rstemp=Server.CreateObject("Adodb.Recordset")
rstemp.cachesize=8
name=cstr(trim(request.querystring("which")))
rstemp.Open "select * from inforcenter where cateid='"&law&"'" ,conn,1,1
if rstemp.eof and rstemp.bof then
response.write "<center><font size=2 color=blue>抱歉!现在暂无!</font></center>"
else
rstemp.MoveFirst
rstemp.pagesize=mypagesize
maxcount=cint(rstemp.pagecount)
rstemp.absolutepage=mypage
howmanyrecs=0
howmanyFields=rstemp.Fields.count-1
dd=rstemp.recordcount
%>
<br>
<table width="95%" border="0" align="center">
<tr>
<td><font color="#FF00FF" size="4">专家</font></td>
</tr>
</table>
<table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#333333">
<tr bgcolor=#215FA8>
<td width="10%"><font color="#FFFFFF"><strong>标题1</strong></font></td>
<td width="11%"><font color="#FFFFFF"><strong>标题2</strong></font></td>
</tr>
<%do while not rstemp.eof and howmanyrecs<rstemp.pagesize %>
<tr bgcolor=#FFFFFF>
<%
for i=1 to 2
if not rstemp.eof then
%>
<td><a href="displayinfor.asp?id=<%=rstemp("id")%>" target=_blank><%=rstemp("title")%></a></td>
<%
rstemp.movenext
else
%>
<td> </td>
<%
end if
next
%>
</tr>
<%
howmanyrecs=howmanyrecs+1
loop
rstemp.close
%>
</table>
<hr size="1" noshade>
<%
pad="0"
scriptname=request.servervariables("script_name")
for counter=1 to maxcount
If counter>=10 then
pad=""
End If
ref="<a href='"& scriptname &"?whichpage=" & counter
ref=ref & "&pagesize="& mypagesize&"&law="&law&"&title="&title&"'>" & pad & counter & "</a>"
response.write ref & " "
if counter mod 10=0 then
response.write "<br/>"
end if
next
response.write"<br/>"
if mypage>=2 then
response.write" <a href='"&scriptname&"?whichpage=01&law="&law&"&title="&title&"'><font color=blue>第一页</font></a>"
response.write" <a href='"&scriptname&"?whichpage="&mypage-1&"&law="&law&"&title="&title&"'><font color=blue>前一页</font></a> "
else
response.write"<font color=blue> 第一页 </font>"
response.write"<font color=blue> 前一页 </font>"
end if
if maxcount-mypage>=1 then
response.write" <a href='"&scriptname&"?whichpage="&mypage+1&"&law="&law&"&title="&title&"'><font color=blue>后一页</font></a>"
response.write" <a href='"&scriptname&"?whichpage="&maxcount&"&law="&law&"&title="&title&"'><font color=blue>最后页</font></a><br/>"
else
response.write"<font color=blue> 后一页</font>"
response.write"<font color=blue> 最后页</font><br/>"
end if
response.write "<font color=blue>共有" &dd& "条相关信息。</font><br/> "
response.Write "<font color=blue>第" &mypage& "页共" & maxcount & "页</font><br/>"
end if
%>
</TD></TR> </TABLE>
</TD>
<TD> </TD>
</TR>
<TR>
<TD colSpan=3> </TD>
</TR> </TABLE>
<DIV align=center>
<CENTER>
</CENTER></DIV>
</BODY></HTML>
-------------------------------------
数据表:
id
title
表格输出两列16条记录,多余下一页显示。
数据库里共有17记录。
执行此程序,第一页正常显示16条,第二页显示9条,第三页显示1条。
请问究竟错在哪里?分页程序不限制行数和列数时显示正常。
请大家帮帮忙,不胜感激!