| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1098 人关注过本帖
标题:小女子请高手指点~~〖一个分页问题〗
只看楼主 加入收藏
菲儿宝贝
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-7-31
结帖率:0
收藏
已结贴  问题点数:20 回复次数:14 
小女子请高手指点~~〖一个分页问题〗
搜索后可以分页显示第一页,点后面页数搜索为空
<%
Class_Name="Search"
Page_Name="Search -- " & Web_Const(0)
Dim SearchSelectkey
IF Action="Userinfo" THEN
Selectkey=Loginuser_Id
SearchSelectkey=Session("Loginuser") & "Publication card"
Else
Selectkey=checkfSQLstr(Request.form("Selectkey"))
SearchSelectkey=Selectkey
    End IF
    Call Page_Head()
        Table_List="Tx_PrClass"
        FileName="Prclass"
    Set Rs_Manage=server.Createobject("Adodb.Recordset")
        IF Request.form("Searchclass")="Products" THEN
            Sql="Select * from Tx_Products where Products_Flag=1 And "
            IF Request.form("xSearch")="Products_Name" THEN
                Sql = Sql & "Products_Name like '%" & Selectkey & "%'"
            End IF
            IF Request.form("xSearch")="Products_Content" THEN
                Sql = Sql & "Products_Content like '%" & Selectkey & "%'"
            End IF
            Sql = Sql & "order by Products_Date desc"
        End IF
        Rs_Manage.open Sql,Conn,1,1
%>
<style type="text/css">
<!--
.STYLE1 {font-family: Arial, Helvetica, sans-serif}
.STYLE2 {color: #FFCC33}
.STYLE5 {color: #CC0033}
.STYLE6 {color: #000000}
.STYLE8 {color: #0000FF}
.STYLE9 {font-size: 12px}
.STYLE10 {color: #333333}
.STYLE11 {
    font-size: 15px;
    font-weight: bold;
    color: #CC0000;
}
-->
</style>
<body bgcolor="#ffffff" background="images/back.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<link href="word.css" rel="stylesheet" type="text/css">
<span class="STYLE1">
<!--#include file="Page_Head.asp"-->
</span>
<table width="936" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td width="13" class="STYLE1">&nbsp;</td>
    <td width="910" valign="top" class="STYLE1"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="20%" align="left" valign="top"><table width="184" border="0" align="left" cellpadding="0" cellspacing="0">
          <tr>
            <td align="center" valign="top" class="v-11"><table width="184" border="0" align="left" cellpadding="0" cellspacing="0">
              <tr>
                <td align="left" valign="top"><table width="184" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="15">&nbsp;</td>
                      <td width="161" class="hui-12-01 STYLE11"> <span class="hui-12-01"><IMG src="http://www. alt="1"></span>Product-Center </td>
                      <td width="8">&nbsp;</td>
                    </tr>
                </table></td>
              </tr>
              <tr>
                <td align="left" valign="top">
                
                
                <table width="100%" border="0" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
                    <tr>
                      <td bgcolor="#FFFFFF"><br>
                      
                      <ll Class_Tree(0,0)%>                      <%Call Class_Tree(0,0)%></td>
                    </tr>
                </table>                </td>
              </tr>
              <tr>
                <td align="left" valign="top"><table width="184" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="7">&nbsp;</td>
                      <td width="164" class="hui-12-01">  </td>
                      <td width="7">&nbsp;</td>
                    </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
         
          <tr>
            <td align="left" valign="top" height="8">          </tr>
          <tr>
            <td align="center" valign="top"><!--#include file="PageSearch.asp"--></td>
          </tr>
        </table></td>
        <td width="3%">&nbsp;</td>
        <td width="74%" align="left" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#e5e5e5">
          <tr>
            <td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="6" colspan="2">                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td><span class="STYLE1"><span class="STYLE5">&gt;&gt;</span> <span class="STYLE10">Your keyword is</span>:<span class="type-color2"><b><%=SearchSelectkey%></b></span><span style="width:40%;text-align:right;"><span class="STYLE10">There are</span> <span class="type-color2"><b><%=Rs_Manage.recordCount%></b></span>  <span class="STYLE10">related records found. </span></span></td>
                </tr>
                <tr><TD colspan="2">&nbsp;</TD></tr>
                <tr>
                  <td colspan="2">
<%
                Dim xh
                Page_Nexterror=4
                Rs_Manage.PageSize = SearchMax_Class
                totalrec=Rs_Manage.RecordCount
                iPageSize=Rs_Manage.PageSize
                currentPage=request("page")
                IF currentpage="" THEN
                    currentpage=1
                Else
                    IF Not isChkInteger(currentPage) THEN response.Redirect "javascript:history.go(+1);"
                    currentpage=clng(currentpage)
                End IF
                IF totalrec Mod Cint(iPageSize)=0 THEN
                    n= totalrec \ Cint(iPageSize)
                Else
                    n= totalrec \ Cint(iPageSize)+1
                End IF
                IF not (Rs_Manage.bof And Rs_Manage.eof) THEN
                    Rs_Manage.MoveFirst
                    IF currentpage > n THEN currentpage = n
                    IF currentpage<1 THEN currentpage=1
                    Rs_Manage.Move (currentpage-1) * Cint(iPageSize)
                    xh=0
                    dim lineheight
                    While Not Rs_Manage.Eof And page_count<Cint(iPageSize)
                        page_count=page_count+1
                        xh=xh+1
                        IF page_count<>Rs_Manage.RecordCount  THEN
                            lineheight="<DIV CLASS='type-height2'></DIV>"
                        End IF
                        %>
<div class="search-content">
                            <%IF Request.form("Searchclass")="Products" THEN%>
                        <b><%=xh%>.</b><a href="Products.asp?Id=<%=Rs_Manage("Products_Id")%>" target="_blank"><b><%=replace(Rs_Manage("Products_Name"),Selectkey,"<FONT COLOR=#FF0000>" & Selectkey & "</FONT>")%></b></a>
                        <div class="search-content1"><%=replace(gotTopic(nohtml(Rs_Manage("Products_Content")),150,1),Selectkey,"<FONT COLOR=#FF0000>" & Selectkey & "</FONT>")%><%=lineheight%></div>
                            <%End IF%>
</div>
                                                    <%
                        lineheight=""
                    Rs_Manage.MoveNext
                    Wend
                End IF
            Rs_Manage.Close
            Set Rs_Manage=Nothing

            %></td>
                </tr>
                           
               
                <tr>
                  <td height="32" colspan="2" width="500" align="center">
                    <%
            Call Page_Next()
            %></td>
                </tr>
                <tr>
                  <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td align="center" class="v-11 STYLE9"><div align="left"><span class="STYLE10">*If you are unable to search what you want, please contact us for</span> <span class="STYLE8" style="color: #000000"><a href="" class="STYLE8">purchase-for-you</a></span><span style="color: #000000"> <span class="STYLE10">service</span></span></div></td>
                </tr>
                <tr>
                  <td colspan="2">&nbsp;</td>
                </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      
      
      
    </table></td>
    <td width="13" class="STYLE1">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3" class="STYLE1">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3" class="STYLE1">&nbsp;</td>
  </tr>
</table>
<span class="STYLE1">
<!--#include file="Page_Bottom.asp"-->

<%
Call Page_Bottom()
Call CloseConn()
%>
</span>
搜索更多相关主题的帖子: 小女子 
2009-07-31 22:55
菲儿宝贝
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-7-31
收藏
得分:0 
没人~~~~~~~~a
2009-07-31 22:57
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:2 
把搜索条件在页数哪里带上就不会为空了。
2009-07-31 23:14
菲儿宝贝
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-7-31
收藏
得分:0 
是先搜索后再进行翻页,搜索条件会丢失
2009-07-31 23:33
ajiao53
Rank: 1
等 级:新手上路
帖 子:4
专家分:2
注 册:2009-5-21
收藏
得分:2 
代码太琐碎,把主要代码发上来,大家才好看清
2009-08-01 10:23
菲儿宝贝
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-7-31
收藏
得分:0 
<%
Class_Name="Search"
Page_Name="Search -- " & Web_Const(0)
Dim SearchSelectkey
IF Action="Userinfo" THEN
Selectkey=Loginuser_Id
SearchSelectkey=Session("Loginuser") & "Publication card"
Else
Selectkey=checkfSQLstr(Request.form("Selectkey"))
SearchSelectkey=Selectkey
    End IF
    Call Page_Head()
        Table_List="Tx_PrClass"
        FileName="Prclass"
    Set Rs_Manage=server.Createobject("Adodb.Recordset")
        IF Request.form("Searchclass")="Products" THEN
            Sql="Select * from Tx_Products where Products_Flag=1 And "
            IF Request.form("xSearch")="Products_Name" THEN
                Sql = Sql & "Products_Name like '%" & Selectkey & "%'"
            End IF
            IF Request.form("xSearch")="Products_Content" THEN
                Sql = Sql & "Products_Content like '%" & Selectkey & "%'"
            End IF
            Sql = Sql & "order by Products_Date desc"
        End IF
        Rs_Manage.open Sql,Conn,1,1
%>
2009-08-01 17:19
菲儿宝贝
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-7-31
收藏
得分:0 
<%
                Dim xh
                Page_Nexterror=4
                Rs_Manage.PageSize = SearchMax_Class
                totalrec=Rs_Manage.RecordCount
                iPageSize=Rs_Manage.PageSize
                currentPage=request("page")
                IF currentpage="" THEN
                    currentpage=1
                Else
                    IF Not isChkInteger(currentPage) THEN response.Redirect "javascript:history.go(+1);"
                    currentpage=clng(currentpage)
                End IF
                IF totalrec Mod Cint(iPageSize)=0 THEN
                    n= totalrec \ Cint(iPageSize)
                Else
                    n= totalrec \ Cint(iPageSize)+1
                End IF
                IF not (Rs_Manage.bof And Rs_Manage.eof) THEN
                    Rs_Manage.MoveFirst
                    IF currentpage > n THEN currentpage = n
                    IF currentpage<1 THEN currentpage=1
                    Rs_Manage.Move (currentpage-1) * Cint(iPageSize)
                    xh=0
                    dim lineheight
                    While Not Rs_Manage.Eof And page_count<Cint(iPageSize)
                        page_count=page_count+1
                        xh=xh+1
                        IF page_count<>Rs_Manage.RecordCount  THEN
                            lineheight="<DIV CLASS='type-height2'></DIV>"
                        End IF
                        %>
<div class="search-content">
                            <%IF Request.form("Searchclass")="Products" THEN%>
                        <b><%=xh%>.</b><a href="Products.asp?Id=<%=Rs_Manage("Products_Id")%>" target="_blank"><b><%=replace(Rs_Manage("Products_Name"),Selectkey,"<FONT COLOR=#FF0000>" & Selectkey & "</FONT>")%></b></a>
                        <div class="search-content1"><%=replace(gotTopic(nohtml(Rs_Manage("Products_Content")),150,1),Selectkey,"<FONT COLOR=#FF0000>" & Selectkey & "</FONT>")%><%=lineheight%></div>
                            <%End IF%>
2009-08-01 17:20
菲儿宝贝
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-7-31
收藏
得分:0 
搜索后可以显示结果,点第二页,第三页,后面任何一页,结果丢失
2009-08-01 17:21
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
给你一个我以前写的分业搜索的例子参考一下

AspSearch.rar (14.13 KB)
2009-08-01 21:00
cnxxzhr
Rank: 1
等 级:新手上路
帖 子:2
专家分:2
注 册:2006-11-1
收藏
得分:2 
是因为在下几页的链接那里没有把上次保存起来的变量传递过去。用?号的。

2009-08-01 21:44
快速回复:小女子请高手指点~~〖一个分页问题〗
数据加载中...
 
   



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

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