标题:求助!!怎样实现下面代码的搜索分页。
只看楼主
fenghuanke
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-3-22
结帖率:100%
已结贴  问题点数:20 回复次数:2 
求助!!怎样实现下面代码的搜索分页。
<style>
@media print {
.print   {display:block;}
.noprint {display:none}
}
</style>

<!--#include file="conn.asp" -->
        <% action = request("action") %>
        <% if session("adminname") = "" or session("adminpassword") = "" then %>
        <script>alert('你还没有登录呢');history.back();</script>
        <% else %>
        <%
        set rswebsite=server.createobject("adodb.recordset")
        sqlwebsite = "select *,web_id from website "
        rswebsite.open sqlwebsite,conn,1,1   

        set rsstudent=server.createobject("adodb.recordset")
        sqlstudent = "select * from student order by adid desc"
        rsstudent.open sqlstudent,conn,1,1     

        %>
<link href="css/css.css" rel="stylesheet" type="text/css">
<title>信息查询</title>
        


<style type="text/css">
<!--
body {
    background-image: url();
}
.STYLE1 {color: #333333}
-->
</style>
<style type="text/css">
<!--
.STYLE2 {color: #CCCCCC}
-->
</style>
<style type="text/css">
<!--
.STYLE3 {color: #FFFFFF}
-->
</style>
<div class="noprint">
<!--#include file="top.asp"-->
</div>
<table width="886" height="640" border="1" align="center" bordercolor="#F9F9F9" background="image/water.gif">
  <tr>
    <td width="887" height="634" align="center" valign="top" bordercolor="#3F6CB0"><div class="noprint"><table width="663" height="26" align="center">
          <tr>
            <td width="666" height="20" align="center" border="0"><marquee>
              <span class="p12"><%=rswebsite("web_note")%></span>
              </marquee>            </td>
          </tr>
        </table>

        <table width="464" height="21" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#999999">
          <tr>
            <td width="100%" align="center" bgcolor="#609B95" class="l11"><strong>信 息 查 询</strong></td>
          </tr>
          <tr>
            <td bgcolor="#FFFFFF"><!--#include file="cxmh.asp" --></td>
          </tr>
        </table>
</div>

      <table width="877" height="20" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#999999">
      <tr>
        <td width="169" align="center" bordercolor="#FFFFFF" bgcolor="#609B95" class="l11"><span class="p12"><strong>学校</strong></span></td>
        <td width="80" align="center" bordercolor="#FFFFFF" bgcolor="#609B95" class="l11"><strong>年级</strong></td>
        <td width="80" align="center" bordercolor="#FFFFFF" bgcolor="#609B95" class="l11"><strong>班级</strong></td>
        <td width="79" align="center" bordercolor="#FFFFFF" bgcolor="#609B95" class="l11"><strong>学籍号</strong></td>
        <td width="90" height="23" align="center" bordercolor="#FFFFFF" bgcolor="#609B95" class="l11"><strong>姓名</strong></td>
        <td width="52" align="center" bordercolor="#FFFFFF" bgcolor="#609B95" class="l11"><strong>性别</strong></td>
        <td width="58" align="center" bordercolor="#FFFFFF" bgcolor="#609B95" class="l11"><span class="p12"><strong>最近成绩</strong></span></td>
        <td width="59" align="center" bordercolor="#FFFFFF" bgcolor="#609B95" class="l11"><span class="p12"><strong>序号</strong></span></td>
        <td width="60" align="center" bordercolor="#FFFFFF" bgcolor="#609B95" class="l11"><span class="p12"><strong>操行评定</strong></span></td>
        <td width="60" align="center" bordercolor="#FFFFFF" bgcolor="#609B95" class="l11"><span class="p12"><strong>学籍状态</strong></span></td>
        <td width="71" align="center" bordercolor="#FFFFFF" bgcolor="#609B95" class="l11"><strong>操 作</strong></td>
      </tr>
      <tr>
                <% if action="ok"  then  %>
                <%
                keyword = request.form("getSql")
                set rsstudent=server.createobject("adodb.recordset")
                xsxx=1
                if keyword="" then
                sqlstudent="select * from student order by adid desc"
                else
                sqlstudent="select * from student where "& keyword &" order by adid desc"
                end if
                rsstudent.open sqlstudent,conn,1,1%>
                <%if rsstudent.eof and rsstudent.bof then%>
               
                <%response.write "<SCRIPT LANGUAGE=JavaScript>alert (' 抱歉没有找到您想要的数据!');window.location.href='admin_xxcx.asp';</script>"%>
                <%else%>
               
                <%
        page = request("page")        
        rsstudent.pagesize = "25"
        if page = "" or page < "1" then
        page = "1"
        end if
        if rsstudent.pagecount > "0" then
        rsstudent.absolutepage = page
        end if
        w=0
         %>
                <%do while not rsstudent.eof or rsstudent.bof %>
         

        <td align="center" bgcolor="#FFFFFF" class="p12"><span class="p11"><%=rsstudent("Source_school")%></span></td>
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("nj")%></td>   
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("bj")%></td>   
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("status_number")%></td>        
        <td height="22" align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("name")%></td>
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("sex")%></td>
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("Enter_school_result")%></td>
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("xh")%></td>
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("cxpd")%></td>
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("xjzt")%></td>
        <td align="center" bgcolor="#FFFFFF" class="p12"><strong class="red"><a href="admin_studentmodify.asp?adid=<%=rsstudent("adid")%>">详 细</a></strong></td>
      </tr>
      <%w=w+1
        if w>=rsstudent.pagesize then
        exit do
        end if%>
                <% rsstudent.movenext %>
                <%loop%>
                <%end if%>
            <table width="877" border="0" cellpadding="1" cellspacing="1" bordercolor="#609B95" bgcolor="#999999">
          <tr>
            <td valign="bottom" bgcolor="#609B95" class="l11"><div align="center"><img src="image/zg.gif" alt="总共" width="45" height="18" /><%=rsstudent.recordcount%><img src="image/tjl.gif" alt="条记录" width="60" height="18" /><img src="image/my.gif" alt="每页" width="40" height="18" /><%=rsstudent.pagesize%><img src="image/p.gif" alt="篇" width="20" height="18" />&nbsp;&nbsp;<img src="image/d.gif" alt="第" width="20" height="18" /><%=page%><img src="image/dg.gif" alt="页/共" width="60" height="18" /><%=rsstudent.pagecount%><img src="image/y.gif" alt="页-&gt;" width="35" height="18" />
              <%if page = "1" then%>
                    <img src="image/sy.gif" alt="首页" width="36" height="18" /> <img src="image/syy.gif" alt="上一页" width="60" height="18" />
                    <%else%>
                    <a href="admin_xxcx.asp"><img src="image/sy.gif" alt="首页" width="36" height="18" border="0" /></a><a href="admin_xxcx.asp?page=<%=page-1%>"><img src="image/syy.gif" alt="上一页" width="60" height="18" border="0" /></a>
                    <%end if%>
                    <%if rsstudent.pagecount-page < 1 then%>
                    <img src="image/xyy.gif" alt="下一页" width="60" height="18" /><img src="image/wy.gif" alt="尾页" width="40" height="18" />
                    <%else%>
                    <a href="admin_xxcx.asp?page=<%=page+1%>"><img src="image/xyy.gif" alt="下一页" width="60" height="18" border="0" /></a><a href="admin_xxcx.asp?page=<%=rsstudent.pagecount%>"><img src="image/wy.gif" alt="尾页" width="40" height="18" border="0" /></a>
                    <%end if%>
                <a href="admin_student_dy.asp" class="red"><img src="image/dysj.gif" alt="打印数据" width="80" height="18" border="0" /></a>&nbsp; <a href="admin_sjdc.asp"><img src="image/excel.GIF" width="18" height="18" border="0"><span class="STYLE2 STYLE3">导出数据</span></a> <a href="admin_xxyd.asp">异动</a></div></td>
          </tr>
         
      </table>
          </tr>


    </table>
      
                <%end if%>
        <%
        page = request("page")        
        rsstudent.pagesize = "25"
        if page = "" or page < "1" then
        page = "1"
        end if
        if rsstudent.pagecount > "0" then
        rsstudent.absolutepage = page
        end if
        w=0
        xx=0
        if xsxx<>1 then
        %>
         <%do while not rsstudent.eof or rsstudent.bof %>
        <%if rsstudent.eof and rsstudent.bof then%>
               
        <%response.write "<SCRIPT LANGUAGE=JavaScript>alert (' 抱歉还没有数据!');window.location.href='admin_head.asp';</script>"
         response.end        
                %>
        <%end if%>        
         <% xx=1+xx%>
         <%if xx=3  then%>
        <td align="center" bgcolor="#F0F0F0" class="p12"><span class="p11"><%=rsstudent("Source_school")%></span></td>
        <td align="center" bgcolor="#F0F0F0" class="p11"><%=rsstudent("nj")%></td>   
        <td align="center" bgcolor="#F0F0F0" class="p11"><%=rsstudent("bj")%></td>   
        <td align="center" bgcolor="#F0F0F0" class="p11"><%=rsstudent("status_number")%></td>        
        <td height="22" align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("name")%></td>
        <td align="center" bgcolor="#F0F0F0" class="p11"><%=rsstudent("sex")%></td>
        <td align="center" bgcolor="#F0F0F0" class="p11"><%=rsstudent("Enter_school_result")%></td>
        <td align="center" bgcolor="#F0F0F0" class="p11"><%=rsstudent("xh")%></td>
        <td align="center" bgcolor="#F0F0F0" class="p11"><%=rsstudent("cxpd")%></td>
        <td align="center" bgcolor="#F0F0F0" class="p11"><%=rsstudent("xjzt")%></td>
        <td align="center" bgcolor="#F0F0F0" class="p12"><strong class="red"><a href="admin_studentmodify.asp?adid=<%=rsstudent("adid")%>">详 细</a></strong></td>
          </tr>
          <%xx=0%>
          <%else%>
        <td align="center" bgcolor="#FFFFFF" class="p12"><span class="p11"><%=rsstudent("Source_school")%></span></td>
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("nj")%></td>   
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("bj")%></td>   
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("status_number")%></td>        
        <td height="22" align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("name")%></td>
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("sex")%></td>
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("Enter_school_result")%></td>
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("xh")%></td>
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("cxpd")%></td>
        <td align="center" bgcolor="#FFFFFF" class="p11"><%=rsstudent("xjzt")%></td>
        <td align="center" bgcolor="#FFFFFF" class="p12"><strong class="red"><a href="admin_studentmodify.asp?adid=<%=rsstudent("adid")%>">详 细</a></strong></td>
          </tr>
          <%end if%>
          <%w=w+1
        if w>=rsstudent.pagesize then
        exit do
        end if%>
          <% rsstudent.movenext %>
        
          <%loop%>
        
   

    </table>
  <div class="noprint">   
    <table width="877" border="0" cellpadding="1" cellspacing="1" bordercolor="#609B95" bgcolor="#999999">
          <tr>
            <td valign="bottom" bgcolor="#609B95" class="l11"><div align="center"><img src="image/zg.gif" alt="总共" width="45" height="18" /><%=rsstudent.recordcount%><img src="image/tjl.gif" alt="条记录" width="60" height="18" /><img src="image/my.gif" alt="每页" width="40" height="18" /><%=rsstudent.pagesize%><img src="image/p.gif" alt="篇" width="20" height="18" />&nbsp;&nbsp;<img src="image/d.gif" alt="第" width="20" height="18" /><%=page%><img src="image/dg.gif" alt="页/共" width="60" height="18" /><%=rsstudent.pagecount%><img src="image/y.gif" alt="页-&gt;" width="35" height="18" />
              <%if page = "1" then%>
                    <img src="image/sy.gif" alt="首页" width="36" height="18" /> <img src="image/syy.gif" alt="上一页" width="60" height="18" />
                    <%else%>
                    <a href="admin_xxcx.asp"><img src="image/sy.gif" alt="首页" width="36" height="18" border="0" /></a><a href="admin_xxcx.asp?page=<%=page-1%>"><img src="image/syy.gif" alt="上一页" width="60" height="18" border="0" /></a>
                    <%end if%>
                    <%if rsstudent.pagecount-page < 1 then%>
                    <img src="image/xyy.gif" alt="下一页" width="60" height="18" /><img src="image/wy.gif" alt="尾页" width="40" height="18" />
                    <%else%>
                    <a href="admin_xxcx.asp?page=<%=page+1%>"><img src="image/xyy.gif" alt="下一页" width="60" height="18" border="0" /></a><a href="admin_xxcx.asp?page=<%=rsstudent.pagecount%>"><img src="image/wy.gif" alt="尾页" width="40" height="18" border="0" /></a>
                    <%end if%>
                <a href="admin_student_dy.asp" class="red"><img src="image/dysj.gif" alt="打印数据" width="80" height="18" border="0" /></a>&nbsp; <a href="admin_sjdc.asp"><img src="image/excel.GIF" width="18" height="18" border="0"><span class="STYLE2 STYLE3">导出数据</span></a> <a href="admin_xxyd.asp">异动</a></div></td>
          </tr>
          <form action="save2.asp?id=1" method="post" enctype="multipart/form-data"><tr><td bgcolor="#609B95"><input name="file1" type="file">&nbsp;&nbsp;<input name="submit" type="submit" id="submit" value="最近成绩">
          &nbsp;&nbsp;<a href="moban/cj.xls"><span class="STYLE2 STYLE3">Excel模板下载</span></a></td>
          </tr></form>
      </table>
        <%end if%>
</div>                     
      
    </td>
  </tr>
</table>

  <div class="noprint">
<table width="886" border="0" align="center">
  <tr>
                     <td background="image/bg2.png"><div align="center" class="se">Copyright&copy; 2012 SanKe All Rights Reserved.</div></td>
                   </tr>
</table><%end if%><embed src="/mid/01.mid" width="0" height="0"></embed>
</div>
搜索更多相关主题的帖子: website 搜索 request display include 
2013-03-22 11:57
努力吼
Rank: 2
等 级:论坛游民
帖 子:64
专家分:51
注 册:2012-11-12
得分:20 
试试AspNetPager分页

新手上路,多多帮助。。。嘿嘿
2013-03-26 15:02
fenghuanke
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-3-22
得分:0 
我对这个不是很懂,能不能在代码中修改?
2013-03-26 17:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-401565-1-1.html




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

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