您现在的位置: PQ秀秀网 >> PQ知道 >> 正文 用户登录 新用户注册
产品分页的问题请高手帮帮忙! Web 开发 / ASP
作者:佚名    文章来源:不详    点击数:加载中...    更新时间:2008-7-12 字体:[ ]
添加到收藏: 添加到百度收藏  收藏到QQ书签  添加到雅虎收藏  添加到新浪ViVi  添加到天极网摘  添加到和讯网摘

产品分页的问题请高手帮帮忙!

楼主wengkay()2006-12-21 17:55:03 在 Web 开发 / ASP 提问

<!--#include   file="conn.asp"-->  
  <%  
   
  dim   currentpage,page_count,Pcount  
  dim   totalrec,endpage  
  currentPage=request("page")  
  if   currentpage=""     then  
  currentpage=1  
  else  
  currentpage=clng(currentpage)  
  if   err   then  
  currentpage=1  
  err.clear  
  end   if  
  end   if  
   
  Productid=session("Productid")  
  if   request("Productnub")   =   ""   then  
  set   rs=Server.CreateObject("ADODB.RecordSet")  
  rs.open   "Select   *   from   Product   where   RoomID='"&session("Productid")&"'   order   by   id   desc",conn,1,3  
  else  
  Productid   =   request("Productnub")  
  set   rs=Server.CreateObject("ADODB.RecordSet")  
  rs.open   "Select   *   from   Product   where   RoomID='"&   Productid   &"'   order   by   id   desc",conn,1,3  
  end   if  
  %>  
  <html>  
  <head>  
  <meta   http-equiv="Content-Language"   content="zh-cn">  
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">  
  <title>产品展示</title>  
  <style   type="text/css">  
  <!--  
  body   {     font-size:   9pt}  
  table   {     font-size:   9pt}  
  .c1   {   font-size:   10.5pt}  
  a   {     text-decoration:   none;   font-size:   9pt}  
  a:visited   {     color:   #0000FF;   text-decoration:   none;   }  
  a:hover   {     color:   #FF0033;   text-decoration:   none;   }  
  -->  
  </style>  
  </head>  
  <body   bgcolor="#F7F7F7">  
  <div   align="center">  
      <table   border="0"   width="100%"   cellspacing="0"   cellpadding="2">  
          <tr>    
              <td   width="200%">&nbsp;</td>  
          </tr>  
      </table>  
  </div>  
  <div   align="center">  
      <center>  
          <table   width="100%"   height="212"   border="0"   cellpadding="3"   cellspacing="0">  
              <%   if   rs.eof   then   %>  
              <tr>    
                  <td>   对不起,现在没有图像数据!</td>  
              </tr>  
              <%  
  else  
  rs.PageSize   =   Cint(4)  
  rs.AbsolutePage=currentpage  
  page_count   =   0  
  totalrec   =   rs.recordcount  
  while   (not   rs.eof)   and   (not   page_count   =   Cint(4))  
  %>  
              <tr>    
                  <%  
  js1   =   0                                
                  do   while   js1   <   4  
                  dim   id  
  id   =   rs("ID")  
                  %>  
                  <td   align="center">   <table   width="150"   height="130"   cellspacing="1"   bgcolor="#E4E4E4"   style="table-layout:fixed   ">         <tr>    
                              <a   href="#"   onClick="javascript:parent.contents.mainFrame.icon(<%=id%>);"   ><td     height="100"   bgcolor="#F7F7F7"   style="cursor:hand"><div   align="center"><img   border="0"   src="<%=rs("IconURL")%>"></div></td></a>  
                          </tr>  
                      </table>  
                  <table   width="150"   border="0"   cellpadding="0"   cellspacing="1"   bgcolor="#E4E4E4">  
                          <tr>    
                              <td   width="70"   align="center">名称:<%=rs("Name")%></td>  
                              <td   width="77"   align="center">价格:<%=rs("Price")%></td>  
                          </tr>  
                      </table></td>  
  <%  
  rs.movenext  
  if   rs.eof   then                            
  exit   do                
  end   if                      
  js1   =   js1   +   1                          
  loop  
  %>  
              </tr>  
              <%  
  wend  
  Pcount   =   rs.PageCount  
  %>  
              <td   height="24"   colspan="6">   <table   border="0"   width="100%"   cellspacing="0"   cellpadding="0">  
                      <tr>    
                          <td   align="center">分页:    
                              <%  
  if   currentpage   >   4   then  
  response.write   "<a   href=""?page=1&roomnub="&roomid&""">[1]</a>   ..."  
  end   if  
  if   Pcount>currentpage+3   then  
  endpage=currentpage+3  
  else  
  endpage=Pcount  
  end   if  
  for   i=currentpage-3   to   endpage  
  if   not   i<1   then  
  if   i   =   clng(currentpage)   then  
                  response.write   "   <font   color=red>["&i&"]</font>"  
  else  
                  response.write   "   <a   href=""?page="&i&"&roomnub="&roomid&""">["&i&"]</a>"  
  end   if  
  end   if  
  next  
  if   currentpage+3   <   Pcount   then    
  response.write   "...   <a   href=""?page="&Pcount&"&roomnub="&roomid&""">["&Pcount&"]</a>"  
  end   if  
  %>   </td>  
                      </tr>  
                  </table></td>  
              </tr>  
          </table>  
      </center>                              
  </div>                          
  </body>                              
  </html>                  
  <%            
  rs.close            
  conn.close  
  end   if              
  %>            
   
  产品是分类的。可就是分不了页。帮忙解决下 问题点数:100、回复次数:4Top

1 楼jxsddboy22(此人已死,有事烧纸)回复于 2006-12-21 18:28:15 得分 0

你的数据库打开方式是1,3  
  当然不能分页  
  改成3,3Top

2 楼cpp2017(慕白兄)回复于 2006-12-21 18:29:13 得分 0

try:  
   
  rs.open   "Select   *   from   Product   where   RoomID='"&session("Productid")&"'   order   by   id   desc",conn,3,3  
  Top

3 楼lhfx1985()回复于 2006-12-21 20:07:34 得分 0

rs.open   "Select   *   from   Product   where   RoomID='"&session("Productid")&"'   order   by   id   desc",conn,3,3  
  Top

4 楼wengkay()回复于 2006-12-21 20:42:33 得分 0

用3,3的我试过了不可以的Top

文章录入:andy    责任编辑:andy 
  网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)