标题:[求助]分页问题(已解决)
只看楼主
lzlcn
Rank: 2
来 自:广东网络公司
等 级:论坛游民
帖 子:100
专家分:10
注 册:2007-5-18
结帖率:100%
 问题点数:0 回复次数:3 
[求助]分页问题(已解决)
不能分页怎么回事 rs.pagecount总是等于1
<!--原代码-->
<!--#include file="conn123/conn.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>##########</title>
<!-- auther: liaoyin -->
<style type="text/css">
A:link,A:active,A:visited{TEXT-DECORATION:none ;Color:#000000}
A:hover{Color:#4455aa}
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;

}
-->
TD{
font-family: 宋体;
font-size: 12px;
line-height: 15px;
}
.weblink {
    height: 20px;
    width: 170px;
}
.input1 {    BORDER-RIGHT: #a0a0a0 1px solid; BORDER-TOP: #a0a0a0 1px solid; FONT-SIZE: 9pt; BORDER-LEFT: #a0a0a0 1px solid; COLOR: #000000; BORDER-BOTTOM: #a0a0a0 1px solid; FONT-FAMILY: "verdana"; BACKGROUND-COLOR: #ffffff
}
</style>

<script language="javascript" src="fade.js"></script>
<style type="text/css">
<!--
body,td,th {
    color: #000000;
}
-->
</style></head>
<script language=JavaScript>
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function openwin(page,size)
{
window.open(page,"newuser","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,"+ size);
}                                                                                          
</script>

<body>
<!--#include file="head.asp"-->
<table width="1004" border="0" align="center" cellpadding="0" cellspacing="0">
  
  <tr>
    <td height="8"><img src="images/a_r4_c1.jpg" width="1004" height="8"></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="210" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="210" height="33" background="images/a_r10_c1.jpg">?</td>
          </tr>
          <tr>
            <td height="100" background="images/a_r6_c1.jpg" valign="top"><table width="94%"  border="0" align="center" cellpadding="0" cellspacing="0">
                <%
            set rs=server.createobject("adodb.recordset")
            sql="select * from series where ce like '%c%' order by pid"
            rs.open sql,conn,3,1
            %>
                <% if not rs.eof then %>
                <%
                    s=1
                    do while not rs.eof and s<=8                    
                    %>
                <tr>
                  <td height="27" onMouseOver=this.style.backgroundColor='#FFFFFF' onMouseOut=this.style.backgroundColor='#F7F7F7'>?<strong><font color="#ff0000">-&gt;</font></strong><a href="series.asp?id=<% =rs("id") %>" class="1">
                    <% response.write rs("head") %>
                  </a></td>
                </tr>
                <tr>
                  <td height="1" bgcolor="#A3B9E9"></td>
                </tr>
                <%
                    s=s+1
                    rs.movenext
                    loop
                    end if
                    rs.close
                    set rs=nothing
                    %>
            </table></td>
          </tr>
          <tr>
            <td height="4"><img src="images/a_r8_c1.jpg" width="210" height="4"></td>
          </tr>
        </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="10"></td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="210" height="33" background="images/index_r6_c7.jpg">?</td>
            </tr>
            <tr>
              <td height="80" valign="middle" background="images/a_r6_c1.jpg"><table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
                  <form name="form1" method="get" action="search.asp">
                    <tr>
                      <td width="70%" height="21" align="center" valign="middle"><input name="cpname" type="text" class="input1" onClick="Javascript:this.value=''" value="请输入关键字!" size="18" maxlength="40"></td>
                      <td align="center" valign="middle"><input name="imageField" type="image" src="img/index_r1_c25.jpg" width="59" height="26" border="0"></td>
                    </tr>
                  </form>
              </table></td>
            </tr>
            <tr>
              <td height="4"><img src="images/a_r8_c1.jpg" width="210" height="4"></td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="10"></td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="210" height="33" background="images/a_r12_c1.jpg">?</td>
            </tr>
            <tr>
              <td height="60" align="center" background="images/a_r6_c1.jpg"><select onChange="if (this.options[this.selectedIndex].value!='') window.open(this.options[this.selectedIndex].value)" size=1 name=select4  class="weblink">
                  <option value="#" selected>?? --> 友情链接 <-- </option>
                  <%
            set rs=server.createobject("adodb.recordset")
            sql="select * from weblink where ce like '%c%' order by pid"
            rs.open sql,conn,3,1
            %>
                  <% if not rs.eof then %>
                  <%
                    
                    do while not rs.eof                
                    %>
                  <option value="<% =replace(rs("link_about")," ","") %>">
                  <% =rs("link_head") %>
                  </option>
                  <%
              rs.movenext
              loop
              end if
              rs.close
              set rs=nothing
              %>
              </select></td>
            </tr>
            <tr>
              <td height="4"><img src="images/a_r8_c1.jpg" width="210" height="4"></td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="10"></td>
            </tr>
          </table></td>
        <td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/product.jpg" width="794" height="39"></td>
          </tr>
          <tr>
            <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="13">?</td>
              </tr>
              <tr>
                <td align="center" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="1%" height="258">?</td>
                    <td align="center" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td height="20"></td>
                        </tr>
                      </table>
                        <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
                          <tr>
                            <td height="355" align="center"><%
            page=request.querystring("page")
                        
            if page=""  then
            page=1
            else                  
            if isnumeric(page)=false then
            response.write"<script language ='javascript'>alert('页数错误,请重新输入!');history.go(-1);</script>"
            response.end
            end if                  
            end if            
            
        
            set rs=server.createobject("adodb.recordset")
            sql="select * from series where ce like '%c%' order by pid"
            rs.open sql,conn,3,1
            pagec=rs.pagecount            
            %>
                                <%
                                if not rs.eof then %>
                                <%
                  if rs.pagecount>1 then
                  %>
                              ?<a href=product.asp?page=1><img src="c1/first.gif" width="45" height="20" border=0></a>?
                              <%
                 end if
                 %>
                              <%
                  if page>1 then
                  %>
                              ?<a href=product.asp?page=<% =page-1 %>><img src="c1/prev.gif" width="45" height="20" border=0></a>?
                              <%
                 end if
                 %>
                              <%
                  if clng(page)<clng(rs.pagecount) then
                  %>
                              ?<a href=product.asp?page=<% =page+1 %>><img src="c1/next.gif" width="45" height="20" border=0></a>?
                              <%
                 end if
                 %>
                              <%
                  if rs.pagecount<>1 then
                  %>
                              ?<a href=product.asp?page=<% =rs.pagecount %>><img src="c1/end.gif" width="45" height="20" border=0></a>?
                              <%
                 end if
                 %>
                              <table width="90%" border="0" cellspacing="0" cellpadding="0" height="5">
                                <tr>
                                  <td></td>
                                </tr>
                              </table>
                              <table width="100%" border="0" cellspacing="0" cellpadding="3" align="center" height="25">
                                <tr>
                                  <td valign="middle" align="left" bgcolor="#F7F7F7"><b><font color=#FF0000>
                                    <%=rs("head") %>
                                    </font></b>
                    <% ="[共计:<b>"&rs.recordcount&"</b>个系列产品]" %>
                    <% =" [共有:<b>"&rs.pagecount&"</b>页] " %>
                                    现在是第<b><%=page%></b>页
                                    <% if rs.pagecount>1 then %>
                                    查看
                                    <%
                 p=clng(page)+1
                 pp=1
                 do while pp<=5 and p<=rs.pagecount
                 %>
                                    <a href=product.asp?page=<% =p %>><b>
                                      <% =p %>
                                      </b></a>
                                    <%  
                 p=p+1
                 pp=pp+1
                 loop %>
                                    页
                                    <% end if %>                                  </td>
                                </tr>
                              </table>
                              <br>
                              <table width="100%" border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC">
                                <%
              rs.absolutepage=page
        s=1
        do while not rs.eof and s<=rs.pagesize
        %>
                                <%
          a=1
          do while not rs.eof and not rs.bof and a<=1
          %>
                                <tr align="center" bgcolor="#FFFFFF">
                                  <td width="100%" align="left" valign="top" bgcolor="#F7F7F7" ><p style="line-height:250%"><a href=series.asp?id=<% =rs("id") %> target="_blank" > <font  color=#990000> <b> <img src="img/small.gif" width="9" height="9" border=0>
                              <% response.write rs("head") %>
                                  </b> </font> </a> </td>
                                </tr>
                                <tr align="center" bgcolor="#FFFFFF">
                                  <td valign="top" align="center" ><table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
                                    <%
        set rs0=server.createobject("adodb.recordset")
        sql="select * from product where sid="&clng(rs("id"))&" order by pid"
        rs0.open sql,conn,3,1        
        if not rs0.eof then
        u=1
        do while not rs0.eof and u<=(clng(rs0.pagesize)/4)
        %>
                                    <tr align="center" bgcolor="#FFFFFF">
                                      <%
          a=1
          do while not rs0.eof and not rs0.bof and a<=4
          %>
                                      <td height="148" align="left" valign="middle"><table width="190" border="0" cellpadding="5" cellspacing="0" bgcolor="#Ffffff">
                                        <tr align="center" bgcolor="#FFFFFF">
                            <td height="148" align="center" valign="middle" background="images/prodbg.jpg"><p style="line-height:250%"><a href="javascript:openwin('prodshow.asp?id=<% =rs0("id") %>','top=80,left=80,width=700,height=600')" class="1"><img src="<% =rs0("pic") %>"  border="0"  width="<% =rs0("pic_w") %>" height="<% =rs0("pic_h") %>" alt="<% =rs0("head") %>" class="2"></a> </td></tr><tr><td align="center"><% response.write rs0("head") %>
                            </td>
                          </tr>
                     </table></td><%
          a=a+1
          rs0.movenext
          loop
                   %>
                                    </tr>
                                    <%
        u=u+1
        loop
                end if
                rs0.close
                set rs0=nothing
                %>
                                  </table></td>
                                </tr>
                                <%
          a=a+1
          rs.movenext
          loop
                   %>
                                <%
        s=s+1
        loop
                %>
                              </table>
                              <br>
                              <table width="100%" border="0" cellspacing="0" cellpadding="3" align="center" height="25">
                                <tr>
                                  <td valign="middle" align="center"><%
                  if rs.pagecount>1 then
                  %>
                                    ?<a href=product.asp?page=1><img src="c1/first.gif" border=0></a>?
                                    <%
                 end if
                 %>
                                    <%
                  if page>1 then
                  %>
                                    ?<a href=product.asp?page=<% =page-1 %>><img src="c1/prev.gif" border=0></a>?
                                    <%
                 end if
                 %>
                                    <%
                  if clng(page)<clng(rs.pagecount) then
                  %>
                                    ?<a href=product.asp?page=<% =page+1 %>><img src="c1/next.gif" border=0></a>?
                                    <%
                 end if
                 %>
                                    <%
                  if rs.pagecount<>1 then
                  %>
                                    ?<a href=product.asp?page=<% =rs.pagecount %>><img src="c1/end.gif" border=0></a>?
                                    <%
                 end if
                 %>                                  </td>
                                </tr>
                              </table>
                              <%
                    end if
                    rs.close
                    set rs=nothing
                    %>                            </td>
                          </tr>
                      </table></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
 <!--#include file="bottom.asp"-->
</body>
</html>
<!--#include file="conn123/close.asp"-->

[[it] 本帖最后由 lzlcn 于 2008-4-26 14:00 编辑 [/it]]
搜索更多相关主题的帖子: body title text 
2008-04-26 12:10
longziyong
Rank: 2
来 自:四川省威远县
等 级:禁止访问
帖 子:77
专家分:23
注 册:2007-8-22
得分:0 
<% if not rs.eof then %>
<%
     do while not rs.eof               
%>
。。。。。
        <%
        rs.movenext
   loop
end if

改为:
<% for position=1 to ipagesize %>
。。。。。。'这里是要分页显示的具体数据
<% rs.movenext
  if rs.eof then
     exit for
  end if
next %>
其中ipagesize是每页要显示的记录数!

[[it] 本帖最后由 longziyong 于 2008-4-26 13:08 编辑 [/it]]

LZY'Blog http://www.
2008-04-26 13:05
lzlcn
Rank: 2
来 自:广东网络公司
等 级:论坛游民
帖 子:100
专家分:10
注 册:2007-5-18
得分:0 
我很奇怪的就是    
        pagec=rs.pagecount
            %>
                                <% if not rs.eof then %>
                                <%
                  if rs.pagecount>1 then
                  %>
rs.pagecount总是为1,这搞不明白,导至,我后面的if 语句都继续

弃我去者昨日之日不可留,乱我心者今日之日多烦忧。
2008-04-26 13:25
lzlcn
Rank: 2
来 自:广东网络公司
等 级:论坛游民
帖 子:100
专家分:10
注 册:2007-5-18
得分:0 
原来这个页没有问题,我没有添加分类。
辛苦大家了

弃我去者昨日之日不可留,乱我心者今日之日多烦忧。
2008-04-26 14:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-211203-1-1.html




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

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