| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 739 人关注过本帖
标题:关于翻页的问题
取消只看楼主 加入收藏
xiaolaba3330
Rank: 1
来 自:辽宁大连
等 级:新手上路
帖 子:175
专家分:0
注 册:2007-10-19
结帖率:100%
收藏
 问题点数:0 回复次数:1 
关于翻页的问题
<%@ LANGUAGE="VBScript" %>
<script language="VBScript" runat="server" ></script>
<html>
<head></head>
<body>
<center>
<%
 Sub ShowHeader(tabletitle)
      Response.Write("<p>【<b>" & tabletitle & "</b>】")
      Response.Write("<table border='1' width='80%'>")
      Response.Write("<tr align='left'>")
      Response.Write("<th width='25%'>会员账号</th>")
      Response.Write("<th width='25%'>球队名称</th>")
      Response.Write("<th width='25%'>会员积分</th>")
      Response.Write("<th width='25%'>会员头衔</th>")
      Response.Write("</tr>")
   End Sub
 bh = Request("hyzh")
 qm = Request("qmlm")
if bh <> "" then
' 注释:生成SQL查询语句
 if qm <> "" then
   mysql = "SELECT main.会员账号,main.会员积分,main.会员头衔,team.球队名称 " & _
             " FROM main " & _
            " INNER JOIN team ON main.球迷联盟= team.球队编号 " & _
            " WHERE  会员账号 LIKE '%" & Request("hyzh") & "%'" & _
              " AND  球迷联盟 = '" & Left(Request("qmlm"),3) & "'"   
' 注释:连接数据库
   Set objRS = Session("objRS")
   objRS.Source = mysql
   objRS.Open
' 注释:显示查询结果
' 注释:此处为分页查询

       If objRS.RecordCount > 0 Then
       If Request("ps") = "" Then
         objRS.PageSize = 10
      Else
         objRS.PageSize = CInt(Request("ps"))
      End If
      If Request("pn") = "" Then
         CurPage = 1
      Else
           CurPage = CInt(Request("pn"))
      End if
      objRS.AbsolutePage = CurPage
   ' 注释:显示分页信息
      Response.Write("共有【" & objRS.RecordCount & "】条记录")
' 注释:制作分页导航
       If objRS.PageCount > 1 Then
           Response.Write(",分成【" & objRS.PageCount & "】页:")
           For i = 1 to objRS.PageCount
              If i = CurPage Then Response.Write("<b>")
%>
     <a href="search2.asp?pn=<% =i %>">第<% =i %>页</a>>
<%
            If i = CurPage Then Response.Write("</b>")
         Next
      End If
          Call ShowHeader("会员信息")
          Do While Not objRS.EOF
         Response.Write("<tr>")
         Response.Write("<td>" & objRS("会员账号") & "</td>")
         Response.Write("<td>" & objRS("球队名称") & "</td>")
         Response.Write("<td>" & objRS("会员积分") & "</td>")   
         Response.Write("<td>" & objRS("会员头衔") & "</td>")
         Response.Write("</tr>")
           objRS.MoveNext
       Loop
      End If
     else
       mysql = "SELECT main.会员账号,main.会员积分,main.会员头衔,team.球队名称 " & _
             " FROM main " & _
            " INNER JOIN team ON main.球迷联盟= team.球队编号 " & _
            " WHERE  会员账号 LIKE '%" & Request("hyzh") & "%'"   
' 注释:连接数据库
   Set objRS = Session("objRS")
   objRS.Source = mysql
   objRS.Open
' 注释:显示查询结果
' 注释:此处为分页查询

       If objRS.RecordCount > 0 Then
       If Request("ps") = "" Then
         objRS.PageSize = 10
      Else
         objRS.PageSize = CInt(Request("ps"))
      End If
      If Request("pn") = "" Then
         CurPage = 1
      Else
           CurPage = CInt(Request("pn"))
      End if
      objRS.AbsolutePage = CurPage
   ' 注释:显示分页信息
      Response.Write("共有【" & objRS.RecordCount & "】条记录")
' 注释:制作分页导航
       If objRS.PageCount > 1 Then
           Response.Write(",分成【" & objRS.PageCount & "】页:")
           For i = 1 to objRS.PageCount
              If i = CurPage Then Response.Write("<b>")
%>
     <a href="search2.asp?pn=<% =i %>">第<% =i %>页</a>>
<%
            If i = CurPage Then Response.Write("</b>")
         Next
      End If
          Call ShowHeader("会员信息")
          Do While Not objRS.EOF
         Response.Write("<tr>")
         Response.Write("<td>" & objRS("会员账号") & "</td>")
         Response.Write("<td>" & objRS("球队名称") & "</td>")
         Response.Write("<td>" & objRS("会员积分") & "</td>")   
         Response.Write("<td>" & objRS("会员头衔") & "</td>")
         Response.Write("</tr>")
           objRS.MoveNext
       Loop
      End If
     end if
else
    mysql = "SELECT main.会员账号,main.会员积分,main.会员头衔,team.球队名称 " & _
             " FROM main " & _
            " INNER JOIN team ON main.球迷联盟= team.球队编号 " & _
            " WHERE  球迷联盟 = '" & Left(Request("qmlm"),3) & "'"
      Set objRS = Session("objRS")
     objRS.Source = mysql
      objRS.Open
    If objRS.RecordCount > 0 Then
    If Request("ps") = "" Then
         objRS.PageSize = 10
      Else
         objRS.PageSize = CInt(Request("ps"))
      End If
      If Request("pn") = "" Then
         CurPage = 1
      Else
           CurPage = CInt(Request("pn"))
      End if
      objRS.AbsolutePage = CurPage
   ' 注释:显示分页信息
      Response.Write("共有【" & objRS.RecordCount & "】条记录")
' 注释:制作分页导航
       If objRS.PageCount > 1 Then
           Response.Write(",分成【" & objRS.PageCount & "】页:")
           For i = 1 to objRS.PageCount
              If i = CurPage Then Response.Write("<b>")
%>
     <a href="srerch2.asp?pn=<% =i %>">第<% =i %>页</a>>
<%
            If i = CurPage Then Response.Write("</b>")
         Next
      End If
      Call ShowHeader("商品信息登记表")
      For i = 1 To objRS.RecordCount
         Response.Write("<tr>")
         Response.Write("<td>" & objRS("会员账号") & "</td>")
         Response.Write("<td>" & objRS("球队名称") & "</td>")
         Response.Write("<td>" & objRS("会员积分") & "</td>")   
         Response.Write("<td>" & objRS("会员头衔") & "</td>")
         Response.Write("</tr>")
         objRS.MoveNext
      Next
   
    End If

  
  end if
' 注释:关闭记录集
   objRS.Close
   Set objRS = Nothing   
%>
</center>
</body>
</html>

显示第一页的时候还正常,要是翻到第二页的话就显示的是全部信息了~~~~

asp.rar (11.71 KB)


我把附件上传了,希望高手帮我看下~~~~~

少上传了一个文件 补上
global.rar (799 Bytes)


[[it] 本帖最后由 xiaolaba3330 于 2008-6-19 23:09 编辑 [/it]]
搜索更多相关主题的帖子: asp 
2008-06-19 23:05
xiaolaba3330
Rank: 1
来 自:辽宁大连
等 级:新手上路
帖 子:175
专家分:0
注 册:2007-10-19
收藏
得分:0 
没有成功,不过还是谢谢你~~~~~

编程学习中~~
2008-06-20 15:44
快速回复:关于翻页的问题
数据加载中...
 
   



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

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