| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1166 人关注过本帖
标题:翻页问题,急啊。
取消只看楼主 加入收藏
虫子8
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-6-9
收藏
 问题点数:0 回复次数:1 
翻页问题,急啊。
可以翻页,但是下一页的内容和第一页的是一样的。哪位高手可以帮我,非常急啊。


代码如下,哪位朋友帮我分析一下,谢谢。

   <%
     Dim class2,class3,id,prm1,prm2,maxnum,max,link
     id=int(request("id"))
     page=int(request.QueryString("page"))
              If page=0 Then
                 page=1
              End If
              set cmd=Server.CreateObject(")
              cmd.ActiveConnection=conn
              
              
     set class4num=cmd.CreateParameter("@class4",3,1)
              cmd.Parameters.Append class4num
     cmd("@class4")=id
     set pagenum=cmd.CreateParameter("@pagenum",3,1)
              cmd.Parameters.Append pagenum
              cmd("@pagenum")=page
     set maxnum=cmd.CreateParameter("@maxnum",3,2)
     cmd.Parameters.Append maxnum
     cmd.execute()
     max=cmd("@maxnum")
     cmd.Prepared=true
     Set rs=cmd.execute
     rs.AbsolutePage=page
     If (rs.Bof and rs.Eof) Then
        response.Write("<br><br><center><span class='css'>很抱歉,没有找到符合您查询条件的商户……</span></center>")
     Else
   %>
            <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0" class="css">
              <tr>
                <td width="4%" height="25"><img src="../images/list.gif" width="15" height="15"></td>
                <td width="96%" valign="bottom"><%=rs("class4name")%> <font color="#FF0000">(<%=max%>)</font></td>
              </tr>
            </table>
   <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0" class="p9">
              <tr>
                <td colspan="4" bgcolor="65CA00"><img src="../../images/block.gif" width="1" height="2"></td>
              </tr>
              <tr>
                <td width="214" height="25" align="left" bgcolor="E8F6D9">商户名称</td>
                <td width="95" align="left" bgcolor="E8F6D9">折扣</td>
                <td width="208" align="left" bgcolor="E8F6D9">地址</td>
                <td width="50" align="center" bgcolor="E8F6D9">详情</td>
              </tr>
              <tr>
                <td colspan="4" bgcolor="65CA00"><img src="../../images/block.gif" width="1" height="1"></td>
              </tr>
            </table>
   <%
     Do While Not rs.Eof
     If rs("istb")=True Then
     link=""&rs("url")&""
     Else
     link="cust.asp?id="&rs("id")&""
     End If
   %>
            <TABLE width="92%" border=0 align=center cellPadding=0 cellSpacing=0 class="css">
              <TR>
                <TD width="216" height=20 align="left"><a href=<%=link%> target="_blank"><%=left(rs("name"),11)%></A></TD>
                <TD width="95" align="left"><a href=<%=link%> target="_blank"><%=left(rs("actor"),11)%></A></TD>
                <TD width="206" align="left"><a href=<%=link%> target="_blank"><%=left(rs("add1"),11)%></A></TD>
                <TD width="50" align=center><a href=<%=link%> target="_blank">查看</A></TD>
              </TR>
              <tr>
                <td colspan="4" background="../images/dot_02.gif"><img src="../images/block.gif" width="1" height="1"></td>
              </tr>
            </table>
   <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td bgcolor="65CA00"><img src="../../images/block.gif" width="1" height="1"></td>
              </tr>
            </table>
   <%
     rs.movenext
     Loop
   %>
            <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0" class="p9">
              <tr>
                <td height="25" align="center" bgcolor="E8F6D9">
               <%
      totalnum=int((max-1)/10)
      if totalnum<0 Then
            totalnum=0
      End If
      totalnum=totalnum+1
      If totalnum<=1 Then
         response.Write "上一页<img src='../../images/consume/mark_prev_ten.gif' width='13' height='11'>    "
      response.Write "1 | 2| 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10"
      response.Write "    <img src='../../images/consume/mark_next_ten.gif' width='13' height='11'>下一页"
      Else
         response.Write "上一页<img src='../../images/consume/mark_prev_ten.gif' width='13' height='11'>    "
               If page>=10 then
               response.write"<a href=consumelist.asp?id="&request.QueryString("id")&"&page="&(((cstr(page)\10)-1)*10)+1&">上十页<img src='../../images/consume/mark_prev_ten.gif' width='13' height='11'>    </a> "
               End if
               q=(cstr(page)-1)\10
               If q<0 then
               q=1
               End if
               p=(q*10)+1
               Do while p<((q*10)+11)
            If p=page Then
            If page<totalnum then                       
                  Response.Write p&"|&nbsp"
                        Else
                  Response.Write p&"&nbsp"
         End if
               Elseif p<totalnum then
               Response.Write "<a href=consumelist.asp?id="&request.QueryString("id")&"&page="&p&">"&p&"</a>|&nbsp"
               Elseif p=totalnum then
               Response.Write "<a href=consumelist.asp?id="&request.QueryString("id")&"&page="&p&">"&p&"</a>&nbsp"
               End If
               p=p+1
               Loop
      response.Write "    <img src='../../images/consume/mark_next_ten.gif' width='13' height='11'>下一页"
               A=totalnum
               If (A mod 10)=0 then
               A=totalnum-1
               End if
               If page<(A\10)*10 then
               response.write"<a href=consumelist.asp?id="&request.QueryString("id")&"&page="&((((cstr(page)-1)\10)+1)*10)+1&">    <img src='../../images/consume/mark_next_ten.gif' width='13' height='11'>下十页</a>"
               End if
      End If
              %>
                </td>
              </tr>
            </table>
            <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td bgcolor="65CA00"><img src="../../images/block.gif" width="1" height="2"></td>
              </tr>
            </table>
   <%
     End If
     call closeall()
   %>
          </td>
        </tr>
      </table>
    </td>
    <td width="1" bgcolor="#CCCCCC"><img src="../images/block.gif" width="1" height="1"></td>
  </tr>
</table>
搜索更多相关主题的帖子: cmd page int request 
2005-06-09 16:59
虫子8
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-6-9
收藏
得分:0 
GRT大哥,加进去后,显示 错误类型: Microsoft VBScript 编译器错误 (0x800A0401) 语句未结束 /consume/html/consumelist.asp, line 87, column 32 for i=1 to (page-1)*rs.pagesize then -------------------------------^ 要怎么改啊, 有哪位朋友可以帮我吗。
2005-06-10 15:10
快速回复:翻页问题,急啊。
数据加载中...
 
   



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

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