主题:  请教:分页显示为何只显示第一页和第二页

82941016

职务:普通成员
等级:1
金币:0.0
发贴:42
#12005/8/6 9:53:23
我学作分页显示,它只显示第一页和第二页就不显示了(共5条记录,我一页显示一条)
<% 
set conn=server.CreateObject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("shuju.mdb")
sql="select * from lr order by rdate"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
%>
<div align="center"><!-- #BeginLibraryItem "/Library/bbstop.lbi" --><img src="image/top1.gif" width="800" height="135"><!-- #EndLibraryItem -->
  <table width="800" border="1" cellpadding="0" cellspacing="0" class="thin">
    <tr>
      <td height="30" background="../../image/zhuo-1.gif"><div align="center"><span class="style1">心 情 日 记</span></div></td>
    </tr>
    <tr>
      <td height="20"><div align="right">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [<a href="../../index.htm" target="_blank">烽中网</a>]&nbsp;&nbsp; [<a href="insert.asp">留言</a>]&nbsp;&nbsp;&nbsp; [<a href="top.asp">查看</a>]&nbsp;&nbsp;&nbsp; [管理]&nbsp;&nbsp;&nbsp; </div></td>
    </tr>
    <tr>
      <td class="thin">
	  <% if rs.recordcount>0 then
	     ls=1
	     rs.pagesize=cint(ls)
		 zy=rs.pagecount
		 pageno=request("pageno") 
		 if pageno="" then
		    pageno=1
		 end if
		 sa=request("coms")	
		 if sa="上一页" then
		    pageno=pageno-1
			if pageno<1 then
			   pageno=1
			end if   
		 end if
		 if sa="下一页" then	
		    pageno=pageno+1
		 end if
		 rs.absolutepage=pageno
		 rc=cint(ls)	
	     do while not rs.eof and rc>0 
	      %>
	  <table width="100%"  border="1" cellpadding="0" cellspacing="0" class="thin" frame="void">
        <tr>
          <td width="100"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><div align="center"><img src="tuox/<%=rs("icon")%>.gif" width="45" height="54"></div></td>
              </tr>
              <tr>
                <td><div align="center"><%response.Write rs("name")%></div></td>
              </tr>
          </table></td>
          <td valign="top"><table width="100%"  border="1" cellpadding="0" cellspacing="0" class="thin" frame="void">
              <tr>
                <td width="100" height="15"><div align="center">访客发表于:</div></td>
                <td><div align="left"><%response.Write rs("date")%></div></td>
                <td width="50"><div align="center">[<a href="mailto:<%=rs("email")%>">邮箱</a>]</div></td>
              </tr>
              <tr>
                <td width="100"><div align="center">日记内容&nbsp; :</div></td>
                <td colspan="2"><div align="left"><%response.Write rs("text")%></div></td>
              </tr>
              <tr>
                <td width="100" rowspan="2"><div align="center">回复内容&nbsp; : </div></td>
                <td colspan="2"><div align="left"><%response.Write rs("rtext")%></div></td>
              </tr>
              <tr>
                <td colspan="2"><div align="right"><%response.Write rs("rdate")%></div></td>
              </tr>
          </table></td>
        </tr>
        <tr bgcolor="#00CCFF">
          <td height="10" colspan="2">&nbsp;</td>
        </tr>
      </table>
	  <% rc=rc-1
	     rs.movenext
	     loop
 	     else  %>
        <table width="100%"  border="1" cellpadding="0" cellspacing="0" class="thin">
          <tr>
            <td><div align="center">还没有人留言。</div></td>
          </tr>
        </table>
		<% end if%>
		</td>
    </tr>
    <tr>
      <td height="20"><div align="right">
      <form method='get' action="top.asp">
	  &nbsp;共<%=zy%>页&nbsp;&nbsp;&nbsp;<%=rs.recordcount%>条记录&nbsp; 
	  <% if pageno>1 then
	        response.write"<input type='submit' name='coms' with='40' value='上一页'>"
		 end if
		 if pageno<zy then
		    response.write"<input type='submit' name='coms' with='40' value='下一页'>"
		 end if   %>	
		 </form>
	   </div></td>
    </tr>
    <tr>
      <td height="20"><div align="center">维护&copy;烽中人</div></td>
    </tr>
  </table>
</div>
   <% conn.close
   set conn=nothing 
   %>
</body>
</html>



{ 在指尖上绽放的花朵 }

职务:普通成员
等级:5
金币:14.0
发贴:3209
#22005/8/8 10:19:35
试试看直接传入 pageno 能不能出结果?

就是 localhost/index.asp?pageno=3 这样。。。