ASP 语句counts=5 do while 中counts=counts-1为什么在下一页还显示5条记录啊

来源:百度知道 编辑:UC知道 时间:2024/06/16 15:26:31
下面是asp分页显示数据库的代码,语句counts=5 与下面的do while 中counts=counts-1语句理解不了,网页第二页为什么不是4条记录啊,
set rs=Server.CreateObject("adodb.RecordSet")
rs.open "select * from users",conn,1,3
if rs.eof and rs.bof then
response.write"目前没有记录"
else
counts=5
rs.pagesize=counts
allpages=rs.pagecount
page=request("page")
if not isnumeric(page)then page=1
if isempty(page) or cint(page)<1 then
page=1
elseif cint(page)>=allpages then
page=allpages
end if
rs.absolutepage=page
do while(not rs.eof)and counts>0
%>
<tr>
<td ><%=rs("username")%></td>
<td><%=rs("ename")%></td>
<td><%=rs("email")%></td>
</tr>
<%
counts=counts-1
rs.movenext
if rs.eof then exit do

asp分页老问题,我都回答过好多次了!

兄弟,我发一段代码,你自己看看,理解意思以后自己随便怎么排都行。
<!-- -->
<%
if idid<>"" then
response.Write("<table width='98%' border='0' cellspacing='0' cellpadding='0' align='center'><tr>")
hangge=4 '一排显示条数
article=12 '本页显示条数
topiclen=15 '每条限制字数
Picture_width=180 '图片的宽度
Picture_height=122 '图片的高度
web_url="Details.asp?id="&idid '图片的连接
Page_url="ProductsSmall.asp?id="&idid '翻页的连接
set rs=server.CreateObject("adodb.recordset")
sql = "select id,parent,newsort,newspic,topic from viewnews where newsort="&idid&" and shenghe=1 and newspic<>'' order by istop desc,tjnews desc,px asc,id desc"
rs.open sql,conn,1,1
Totalarticle=rs.recordcount
if rs.recordcount>0 then
rs.pagesize=article