| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 691 人关注过本帖
标题:关于查询结果后分页显示!
只看楼主 加入收藏
szp2007
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2008-2-14
结帖率:100%
收藏
 问题点数:0 回复次数:2 
关于查询结果后分页显示!
我现在想要把查询结果进行分页显示,每页显示10条记录,可是现在第一页是正常的.一点击下一页,就出错,各位领导,帮忙看下了,下面就是完整的代码!先谢下!!
<html>
<head>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn_fj16.asp"-->
<!--#include file="admin_qx.asp" -->
<% isdl %>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
<!--
.style5 {color: #000000}
body,td,th {
    font-size: 13px;
}
table {
    word-break:break-all;
}
.STYLE7 {
    font-size: 16px;
    font-weight: bold;
}
.STYLE1 {color: #FF0000}
a:link {
    text-decoration: none;
}
a:visited {
    text-decoration: none;
}
a:hover {
    text-decoration: none;
}
a:active {
    text-decoration: none;
}
body {
    background-color: #d6dff7;
}
-->
</style>
<title>奶牛头数统计表</title>
</head>

<%
ID=trim(request("ID"))
nian=trim(request("nian"))
xiangzhen=trim(request("xiangzhen"))
cun=trim(request("cun"))
if nian<>"" and xiangzhen <>""  and cun="" then
sql="select * from nainiushuliangnianbao where  nian='"&nian&"' and xiangzhen='"&xiangzhen&"' order by xiangzhen desc "
response.Write "<script language=javascript>{window.location.href='nainiushuliang_niaobao_list2.asp';}</script>"
end if
if nian<>"" and xiangzhen="" and cun=""then
sql="select * from nainiushuliangnianbao where nian='"&nian&"'  order by xiangzhen desc"
end if
if nian<>"" and xiangzhen<>"" and cun<>"" then
sql="select * from nainiushuliangnianbao where nian='"&nian&"' and xiangzhen='"&xiangzhen&"' and cun='"&cun&"' order by xiangzhen desc"

end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,2
%>
<p align="center">&nbsp;</p>
<p align="center"><span class="style4">&nbsp; &nbsp;<%=DATE%>共<%=rs.recordcount%>条记录</span>  &nbsp; &nbsp; &nbsp;&nbsp;合计:
<%=total%>

</p>
 <TABLE width=61% border=1 align="center" cellPadding=0 cellSpacing=0
            borderColorLight=#6699ff borderColorDark=#ffffff bgcolor="#FFFFFF" style="border-collapse:collapse">
  <tr>
    <td width="63" nowrap="nowrap" bgcolor="#FFCC66"><div align="center">序号</div></td>
    <td width="80" align="center" nowrap="nowrap" bgcolor="#FFCC66">乡镇</td>
    <td width="71" nowrap="nowrap" bgcolor="#FFCC66"><div align="center">村组</div></td>
    <td width="71" nowrap="nowrap" bgcolor="#FFCC66"><p align="center">日期</p></td>
    <td width="83" nowrap="nowrap" bgcolor="#FFCC66"><div align="center">期初</div></td>
    <td width="80" nowrap="nowrap" bgcolor="#FFCC66"><div align="center">自繁</div></td>
    <td width="81" nowrap="nowrap" bgcolor="#FFCC66"><div align="center">购入</div></td>
    <td width="96" nowrap="nowrap" bgcolor="#FFCC66"><div align="center">出卖</div></td>
    <td width="84" nowrap="nowrap" bgcolor="#FFCC66"><div align="center">死淘</div></td>
    <td width="83" nowrap="nowrap" bgcolor="#FFCC66"><div align="center">实际增加</div></td>
    <td width="106" nowrap="nowrap" bgcolor="#FFCC66"><p align="center">期末</p></td>
   </tr>
  
   <%count=0
   sum=100
do while not rs.eof and count<rs.pagesize %>
   <%if count Mod 2=0 then%><TR bgcolor="#E2EEFC" onMouseOver="this.style.backgroundColor='#FFDA6A'" onMouseOut="this.style.backgroundColor='#E2EEFC'">
<%end if%>
    <td height="27" align="center" valign="middle" nowrap="nowrap"><%=count+1%></td>
   
   <td align="center" valign="middle" nowrap="nowrap"><%=rs("xiangzhen")%></td>
    <td align="center" valign="middle" nowrap="nowrap"><%=rs("cun")%></td>
    <td align="center" valign="middle" nowrap="nowrap"><%=rs("nian")%>年</td>
    <td align="center" valign="middle" nowrap="nowrap"><%=rs("qichu")%></td>
    <td align="center" valign="middle" nowrap="nowrap"><%=rs("zifan")%></td>
    <td align="center" valign="middle" nowrap="nowrap"><%=rs("gouru")%></td>
    <td align="center" valign="middle" nowrap="nowrap"><%=rs("chumai")%></td>
    <td align="center" valign="middle" nowrap="nowrap"><%=rs("sitao")%></td>
    <td align="center" valign="middle" nowrap="nowrap"><%=rs("shijizengjia")%></td>
    <td align="center" valign="middle" nowrap="nowrap"><%=rs("qimo")%></td>
    </tr>
  
   <%rs.movenext
  count=count+1
    loop
  %>
</table>
 <span class="style4">共有<%=rs.recordcount%>条通过审核且不在回收站的记录,每页显示<%=rs.pagesize%>条 ,第<%=page%>/<%=rs.pagecount%>页&nbsp;
 <%if page>1 then%>
 <a href="nainiushuliang_nianbao_list2.asp?Page=<% = 1%>&key=<%=key%>&ziduan=<%=ziduan%>&by=<%=by%>">首页</a><a href="nainiushuliang_nianbao_list2.asp?Page=<% = 1%>"&key=<%=key%>&ziduan=<%=ziduan%>></a> <a href="nainiushuliang_nianbao_list2.asp?Page=<% =page -1 %>&key=<%=key%>&ziduan=<%=ziduan%>&by=<%=by%>">上一页</a><a href="nainiushuliang_nianbao_list2.asp?Page=<% =page -1 %>&key=<%=key%>&ziduan=<%=ziduan%>"></a>
 <%end if %>
 <%if page<>rs.pagecount then %>
 <a href="nainiushuliang_nianbao_list2.asp?Page=<% =page + 1%>&key=<%=key%>&ziduan=<%=ziduan%>&by=<%=by%>">下一页</a><a href="nainiushuliang_nianbao_list2.asp?Page=<% =page + 1%>&key=<%=key%>&ziduan=<%=ziduan%>"></a> <a href="nainiushuliang_nianbao_list2.asp?Page=<% = rs.PageCount%>&key=<%=key%>&ziduan=<%=ziduan%>&by=<%=by%>">尾页</a><a href="nainiushuliang_nianbiao_list2.asp?Page=<% = rs.PageCount%>&key=<%=key%>&ziduan=<%=ziduan%>"></a></span>
 <% end if %>
 <select name="select2" id="select" onChange="javascript:window.location.href('nainiushuliang_niaobao_list2.asp?page='+this.options[this.selectedIndex].value+'&key=<%=key%>&ziduan=<%=ziduan%>&by=<%=by%>')">
   <% for i=1 to rs.pagecount%>
   <option value="<%=i%>" <%if i=page then response.Write("selected") end if%> ><%=i%> </option>
   <% next%>
 </select>
 <span class="STYLE13">
 <select name="pagesize" id="pagesize" onChange="javascript:window.location.href('nainiushuliang_nianbao_list2.asp?pagesize='+this.options[this.selectedIndex].value+'&key=<%=key%>&ziduan=<%=ziduan%>&by=<%=by%>')">
   <% for iii=10 to 50 step 5%>
   <option value="<%=iii%>" <%if iii=rs.pagesize then response.Write("selected") end if%> >每页显示<%=iii%>条记录</option>
   <% next%>
   <% for i=60 to 180 step 20%>
   <option value="<%=i%>" <%if i=rs.pagesize then response.Write("selected") end if%> >每页显示<%=i%>条记录</option>
   <% next%>
   <% for ii=200 to 1000 step 200%>
   <option value="<%=ii%>" <%if ii=rs.pagesize then response.Write("selected") end if%> >每页显示<%=ii%>条记录</option>
   <% next%>
   <option value="10000" <%if rs.pagesize=10000 then response.Write("selected") end if%> >每页显示10000条记录</option>
 </select>
 &nbsp;</span>
 <div align="center"></div>
</body>
</html>
搜索更多相关主题的帖子: 结果 查询 
2008-10-14 22:14
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
点开第一页,记录URL,点开第二页,记录URL,比较。
2008-10-14 22:22
szp2007
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2008-2-14
收藏
得分:0 
可不可以告诉我怎么比较啊,我不会!我在网上也搜索了一些,有些看不懂
2008-10-15 06:01
快速回复:关于查询结果后分页显示!
数据加载中...
 
   



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

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