| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 461 人关注过本帖
标题:asp分页问题,哪位高手帮帮忙
只看楼主 加入收藏
tiexuedaming
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2011-4-15
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:3 
asp分页问题,哪位高手帮帮忙
分页问题,数据库中有10条记录,我分别为a,b,c,d,e,f,g,h,i,j;现在出现个问题,我想每页显示3条,可是第一页出现的是全部10条,第二页出现的是d,e,f,g,h,i,j;第三页出现的是g,h,i,j;第四页出现的是j;哪儿大侠能帮一忙
'显示报名会员信息
<%set rsa=Server.CreateObject("ADODB.recordset")
sqla="select   P_HuiYuan From Ejz_HuoDong_BaoMing where P_Hd_Id="&request.QueryString("id")&" and P_HuiYuan<>''"
'set rsa=conn.execute(sqla)
rsa.open  sqla,conn,3

'response.Write(sqla)  
If not rsa.eof Then
Rsa.Pagesize = 3'每页显示记录数
Psize       = Rsa.PageSize
PCount      = Rsa.PageCount'总页数
RCount      = Rsa.RecordCount'总记录数
'response.Write(PCount)
PageNo = Cint(Request.QueryString("PageNo"))
if PageNo=""  then PageNo=1
If PageNo < 1 Then
    PageNo = 1
Elseif PageNo > PCount Then
    PageNo = PCount
End If
'if not rsa.eof then rsa.AbsolutePage =PageNo
if not (rsa.bof and rsa.eof) then Rsa.AbsolutePage = PageNo %>
...........显示内容,已省略
共<Font color="#FF0000"><%= RCount %></Font>条 分<Font color="#FF0000"><%= PCount %></Font>页
| 当前第<Font color="#FF0000"><%= PageNo %></Font>页</td>
<td width="30%" align="right">
<%
If PageNo > 1 Then
Response.write "<a href=""Index.BaoMing.asp?id="&request.QueryString("id")&""">首页</a>&nbsp;"
Response.write "<a href=""?id="&request.QueryString("id")&"&PageNo="&PageNo-1&""">上页</a>&nbsp;"
Else
Response.write "首页&nbsp;"
Response.write "上页&nbsp;"
End if
%>
<select name="menu2" onChange="form.submit();" style="width:40px;">
<%For i =1 to PCount
 %>
<option value="?PageNo=<%= i %>&id="&request.QueryString("id")&"" <% If i = PageNo Then Response.write "Selected"%>><%=i%></option>
<% Next %>
</select>

<%
If PageNo < PCount Then
Response.write "<a href=""?id="&request.QueryString("id")&"&PageNo="&PageNo+1&""">下页</a>&nbsp;"
Response.write "<a href=""?id="&request.QueryString("id")&"&PageNo="&PCount&""">尾页</a>"
Else
Response.write "下页&nbsp;"
Response.write "尾页"
End if
%>

 
搜索更多相关主题的帖子: 数据库 where 会员 
2011-04-15 17:45
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:5 
你把代码都省略了,怎么查?
if not (rsa.bof and rsa.eof) then Rsa.AbsolutePage = PageNo 这句后面应该有一句最关键的语句,你怎么写的?

----我怎能在别人的苦难面前转过脸去----
2011-04-15 19:37
baobaowork
Rank: 2
等 级:论坛游民
帖 子:2
专家分:15
注 册:2011-4-15
收藏
得分:15 
程序代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.>
<html xmlns="http://www.>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>荣事达北方大区网络管理系统-靠双手创造地区发展,用管理带动品牌提升!</title>
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-color: #FFFFFF;
}
body,td,th {
    font-size: 12px;
    color: #000000;
}
a:link {
    color: #000000;
}
a:visited {
    color: #000000;
}
a:hover {
    color: #330099;
}
a:active {
    color: #330099;
}
.STYLE2 {
    font-size: 16px;
    font-weight: bold;
}
.STYLE3 {
    font-size: 24px;
    color: #FF3300;
}
-->
</style>
</head>




<body>
<%if session("admin")="" then%>
<span class="STYLE3" ></span><center><span class="STYLE3"><br><br><br><br><br><br><br><br><br><br>您还未进行会员登陆,请点击&nbsp;&nbsp;<a href="index.asp" class="STYLE2">这里</a>&nbsp;&nbsp;到登陆页面!
</span></center>
<%else%>


    <%
    ctype=request("ctype")
     sql="select * from news where fenlei_id='"&ctype&"' order by id desc"
    
    dim page,pages,rspagesize,rscount,rscounts
    page=int(request.QueryString("page"))
    if page <= 0 then page = 1
    rspagesize=10
    rscount=rspagesize
    set rs=Server.CreateObject("adodb.recordset")
    rs.open sql,conn,1,1
    rs.PageSize=rspagesize
    if not rs.eof then rs.AbsolutePage=page
    rscounts=rs.RecordCount
    pages=rs.PageCount
   
dim zuozhe
zuozhe=rs("pinpai_id")

Set rs2 = Server.CreateObject("ADODB.Recordset")
sql="select * from vip where rname='"&zuozhe&"' order by id desc"
rs2.open sql,conn,1,1
    %>    



<!--#include file="top.asp"-->
<table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>

      <% while not rs.eof and rscount>0
    %>  <tr>
    <td><table width="960"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="171"><table width="171"  border="0" cellpadding="0" cellspacing="0">
         
          <tr>
            <td height="172" align="center" valign="middle"><img  src="<%=rs2("pic")%>" width="150" height="150" alt="头像" style="background-color: #339900" /></td>
          </tr>
         
        </table></td>
        <td width="25">&nbsp;</td>
        <td colspan="2" valign="top"><table width="764" height="172" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="39" class="STYLE2">标题:<span class="STYLE3"><%=rs("name")%></span></td>
          </tr>
          <tr>
            <td style="line-height:180%"><%if len(rs("content"))>180 then
              response.Write left(rs("content"),180)
              else
              response.Write rs("content")
              end if
    %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="play.asp?id=<%=rs("id")%>" target="_blank">{查看详细页面}</a><br/></td>
          </tr>
          <tr>
            <td height="28"><strong>发表时间:<%=rs("time_year")%><%=rs("time_month")%><%=rs("time_date")%></strong>&nbsp;&nbsp;&nbsp;&nbsp;<strong>所属分类:<%=rs("fenlei_id")%></strong>&nbsp;&nbsp;&nbsp;&nbsp;<strong>作者:<%=rs("pinpai_id")%></strong></td>
          </tr>
        </table></td>
        </tr>
     
    </table></td>
  </tr>
  <tr>
    <td height="25"><hr style="BORDER-BOTTOM-STYLE: dotted; BORDER-LEFT-STYLE: dotted; BORDER-RIGHT-STYLE: dotted; BORDER-TOP-STYLE: dotted" color=#000000 size=1></td>
  </tr><%
    rs.movenext
    rscount=rscount-1
    wend
    %>
  <tr>
    <td height="28" align="center"><%=rscounts%>条 | 共<%=pages%>页 | <%=rspagesize%>条/页
        |
      <select name="select" style="font-size:12px;" onchange="location.href='index_1.asp?ctype=<%=ctype%>&amp;page='+this.value;">
        <%for i=1 to pages%>
        <option value="<%=i%>" <%if page=i then response.Write("selected")%>>第<%=i%></option>
        <%next%>
      </select>
      <%if page>1 then%>
      <a href="index_1.asp?ctype=<%=ctype%>&amp;page=1">首页</a> <a href="index_1.asp?ctype=<%=ctype%>&amp;page=<%=page-1%>">上页</a>
      <%end if
        if page < pages then%>
      <a href="index_1.asp?ctype=<%=ctype%>&amp;page=<%=page+1%>">下页</a> <a href="index_1.asp?ctype=<%=ctype%>&amp;page=<%=pages%>">末页</a>
      <%end if%></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<!--#include file="bot.asp"-->

<%end if%>
</body>
</html>
2011-04-15 20:33
zgy455793893
Rank: 2
等 级:论坛游民
帖 子:5
专家分:32
注 册:2007-5-25
收藏
得分:0 
等待蜘蛛侠帮你解决

www.138ys.cc  www.yo5.cc
2011-04-15 21:34
快速回复:asp分页问题,哪位高手帮帮忙
数据加载中...
 
   



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

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