| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 509 人关注过本帖
标题:ASP分页技术问题,查了好久未果,恳求原因!
只看楼主 加入收藏
mmading
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-1-31
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
ASP分页技术问题,查了好久未果,恳求原因!
代码点击页数查询结果正常,点击下方《上一页》《下一页》《最末页》显示结果为全部记录,查询条件全部无效???


<%Option Explicit%>

<!--#include file="Connections/EmpMain2.asp"-->

<%
dim rs_lar,rs_lar2
dim c_age,c_wbname,c_sex,c_sex2,c_netname,c_home,c_education,c_job,c_netcall,c_tel,c_book,c_music,c_sport,c_interest,c_character,c_photo,c_wbname2
dim age1,age2,wbname,sex,netname,home,education,job,netcall,tel,sport,book,music,interest,character,photo,beizhu,wbname2
dim sql,sql2,sql3,str,hrefdate
dim pages,records,currentpage,linenumber,line,p
dim total,px

px=request("px")
c_wbname=request("c_wbname")
c_wbname2=request("c_wbname2")
c_netname=request("c_netname")
c_job=request("c_job")
c_age=request("c_age")
c_sex=request("c_sex")
c_sex2=request("c_sex2")
wbname=request("wbname")
wbname2=request("wbname2")
netname=request("netname")
job=request("job")
age1=request("age1")
age2=request("age2")
sex=request("sex")
beizhu=request("beizhu")
Set rs_lar = Server.CreateObject("ADODB.Recordset")
Set rs_lar2 = Server.CreateObject("ADODB.Recordset")

hrefdate=""
sql="select * from fahuo ,kufu where = kufu.id "
sql2="select fahuo.维保人员 ,sum (fahuo.coun) as counn from fahuo ,kufu  where = kufu.id "

if c_wbname="ON" then
    sql=sql & " and fahuo.维保人员 like '%"&wbname&"%'"
    sql2=sql2 & "and fahuo.维保人员 like '%"&wbname&"%'"
   hrefdate=hrefdate & "&c_wbname=" & "ON" & "&wbname=" & wbname
end if
if c_netname="ON" then
   sql=sql & " and fahuo.售后归类 like '%"&netname&"%'"
   sql2=sql2 & "and fahuo.售后归类 like '%"&netname&"%'"
   hrefdate=hrefdate & "&c_netname=" & "ON" & "&netname=" & netname
end if
if c_job="ON" then
   sql=sql & " and fahuo.产品名称 like '%"&job&"%'"
   sql2=sql2 & "and fahuo.产品名称 like '%"&job&"%'"
   hrefdate=hrefdate & "&c_job=" & "ON" & "&job=" & job
end if
if c_age="ON" then
   sql=sql & " and  fahuo.datt between #"&age1&"# and #"&age2&"# "
   sql2=sql2 & "and datt between #"&age1&"# and #"&age2&"#"
   hrefdate=hrefdate & "&c_age=" & "ON" & "&age1=" & age1 & "&age2=" & age2
end if
if c_sex="ON" then
   sql=sql & " and kufu.公司名称 like '%"&sex&"%'"
sql2=sql2 & "and  kufu.公司名称 like '%"&sex&"%'"
   hrefdate=hrefdate & "&c_sex=" & "ON" & "&sex=" & sex
end if
 if c_sex2="ON" then
   sql=sql & " and fahuo.特殊说明 like '%"&beizhu&"%'"
sql2=sql2 & "and fahuo.特殊说明 like '%"&beizhu&"%'"
   hrefdate=hrefdate & "&c_sex=" & "ON" & "&sex=" & sex
end if
 if c_wbname2="ON" then
   sql=sql & " and fahuo.维修状况 like '%"&wbname2&"%'"
sql2=sql2 & " and fahuo.维修状况 like '%"&wbname2&"%'"
   hrefdate=hrefdate & "&c_sex=" & "ON" & "&sex=" & sex
end if
sql2=sql2 & "group by fahuo.维保人员 "

Select case px
       case "s_netname"
            sql=sql & " Order by datt asc"
       case "j_netname"
             sql=sql & " Order by datt desc"
End Select

rs_lar.open sql,conn,3,2
rs_lar2.open sql2,conn,3,2

if rs_lar.eof and rs_lar.bof then str="无数据!"
'分页设置
 total=0
 
 do while (not rs_lar.eof)
 c_photo=rs_lar("coun")
total=total+c_photo
     rs_lar.movenext   
     loop

if str="" then
    rs_lar.PageSize=50
    pages=rs_lar.pagecount
    records=rs_lar.recordcount
    currentpage=request("currentpage")
    if currentpage="" or currentpage<1 then currentpage=1
    currentpage=cint(currentpage)
    if currentpage>pages then currentpage=pages
    rs_lar.absolutepage=currentpage
else
    currentpage=1
    records=0
    pages=1
end if
%>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>搜索结果</title>
<style>
<!--
.x:link      { color: white; text-decoration: none }
.x:visited   { color: white; text-decoration: none }
.x:active    { color: red; text-decoration: none }
.x:hover     { color: red;text-decoration:nome}
tr           { font-size: 9pt }
td           { font-size: 9pt }
body         { font-size: 9pt }
a:link       { color: blue; text-decoration: none }
a:visited    { color: blue; text-decoration: none }
a:active     { color: red; text-decoration: none }
a:hover      { color: red; text-decoration: none }
BODY {
    SCROLLBAR-FACE-COLOR: #ee9999; SCROLLBAR-HIGHLIGHT-COLOR: #fef7f7; SCROLLBAR-SHADOW-COLOR: #fef7f7; SCROLLBAR-3DLIGHT-COLOR: #fef7f7; SCROLLBAR-ARROW-COLOR: #ffffff; SCROLLBAR-TRACK-COLOR: #fef7f7; SCROLLBAR-DARKSHADOW-COLOR: #fef7f7
}
.style1 {color: #FFFFFF}

-->
</style>

</head>

<body topmargin="0" bgcolor="#FFF4F4">



<table border="0" width="997">
    <tr>
      <td width="991" align="center" style="border-bottom-style: solid; border-bottom-width: 1">
      <p align="left">
      <font size="2"><a href="#" onClick="window.print()">打印</a>&nbsp;以下是符合您搜索条件的数据</font>
      </p>
      </td>
    </tr>
    <tr>
      <td width="991">
      <font size="2"><i>第<font color="red"><%=currentpage%></font>页&nbsp;找到<font color="blue"><%=Records%></font>条记录&nbsp;共<font color="blue"><%=Pages%></font>页</i></font>
      </td>
    </tr>
    <tr>
      <%if pages>1 then%>
      <td width="991">
      <font size="2"><i>转到页码:[
      <%for p=1 to pages%>
      <a <%if currentpage=p then%> style="color:red"<%end if%> href="searchout.asp?currentpage=<%=p%><%=hrefdate%>"><%=p%></a>
      <%if p/30=0 then%>
      <%end if%>
      <%next%>
      </i></font>
      </td>
      <%end if%>
    </tr>
  </table>
  <!------------------------------------------------------------------------------------------------------------------------->
  <!------------------------------------------------------------------------------------------------------------------------->
 <table border="1" width="1001" cellspacing="0">
       <tr bgcolor="#9966FF">
        <td width="79" align="center" style="border-left-style: solid; border-left-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000">维保日期<font color="#FFFFFF"><a title="按维保日期升序排列" <%if px="s_netname" then%> style="color:red"<%end if%> href="searchout.asp?px=s_netname">&uarr;</a><a title="按维保日期降序排列" <%if px="j_netname" then%> style="color:red"<%end if%> href="searchout.asp?px=j_netname">&darr;</a></font></td>
        <td width="71" align="center" style="border-left-style: solid; border-left-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000">项目名称</td>
        <td width="69" align="center" style="border-left-style: solid; border-left-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000">维修状况</td>
        <td width="82" align="center" style="border-left-style: solid; border-left-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000">维修类型</td>
        <td width="31" align="center" style="border-left-style: solid; border-left-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000">耗时<span class="style1"></span></td>
        <td width="47" align="center" style="border-left-style: solid; border-left-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000">起时间</td>
        <td width="45" align="center" style="border-left-style: solid; border-left-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000">止时间</td>
        <td width="48" align="center" style="border-left-style: solid; border-left-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000">维保人</td>
        <td width="67" align="center" style="border-left-style: solid; border-left-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000">售后归类</td>
        <td width="420" align="center" bordercolor="#000000" style="border-left-style: solid; border-left-width: 1; border-bottom-style: solid; border-bottom-width: 1">备注</font></td>
      </tr>
      <%linenumber=rs_lar.pagesize%>
      <%do while (not rs_lar.eof) and (line<linenumber)%>
      <tr>
        <td width="79" align="center"><%=rs_lar("datt")%></td>
        <td width="71" align="center"><%=rs_lar("公司名称")%></td>
        <td width="69" align="center"><%=rs_lar("维修状况")%></td>
        <td width="82" align="center"><%=rs_lar("产品名称")%></td>
        <td width="31" align="center"><%=rs_lar("coun")%></td>
        <td width="47" align="center"><%=rs_lar("起时间")%></td>
        <td width="45" align="center"><%=rs_lar("止时间")%></td>
        <td width="48" align="center"><%=rs_lar("维保人员")%></td>
        <td width="67" align="center"><%=rs_lar("售后归类")%></td>
        <td align="center"><%=rs_lar("特殊说明")%></td>
      </tr>
   
  
      <%rs_lar.movenext%>
      <%line=line+1%>
      <%loop%>
      <%rs_lar.close%>
</table>
  <!-------------------------------------分页导航--------------------------------------->
  <table width="750">
    <tr>
      <td>
      <font size="2">
      <%if currentpage>1 then%>
      <a href="searchout.asp?currentpage=<%=currentpage-1%>">[上一页]</a>
      <%end if%>
      <%if currentpage<pages then%>
      <a href="searchout.asp?currentpage=<%=currentpage+1%>">[下一页]</a>
      <%end if%>
      <%if currentpage>1 then%>
      <a href="searchout.asp?currentpage=1">[最首页]</a>
      <%end if%>
      <%if currentpage<pages then%>
      <a href="searchout.asp?currentpage=<%=pages%>">[最末页]</a>
      <%end if%>
      </font>
      </td>
    </tr>
  </table>
  <!------------------------------------------------------------------------------------------------------------------------->
<div align="center">
    <center>
    <table border="0" width="221" cellspacing="0">
      <tr>
        <td width="100%" align="left" style="border-bottom-style: solid; border-bottom-width: 1">
          <p align="left"><a href="EmpMain_weibaoSearch.asp">[再搜索]</a> 
            <label for="haoshi">耗时合计:</label>
          <%=total%> </td>
      </tr>
      </table>
    </center>
</div>
<table width="167" border="0">
    <tr>
      <td width="92" height="14" align="left">人员</td>
      <td width="65" align="left">累计耗时</td>
    </tr>
    <%do while not rs_lar2.eof%>

</table>
  <table width="166" height="24" border="0">
    <tr>
     
      <td width="82" align="left"><%=rs_lar2("维保人员")%></td>
      <td width="70" align="left"><%=rs_lar2("counn")%></td>
    </tr>
</table>
</body>

</html>
<% rs_lar2.movenext
 loop
rs_lar2.close
 %>
搜索更多相关主题的帖子: character education interest include music 
2013-09-25 16:28
303770957
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:6
帖 子:838
专家分:2125
注 册:2005-9-10
收藏
得分:20 
if rs_lar.eof and rs_lar.bof then str="无数据!" '这个str变量之前是个什么值?你定义的时候没有给初值吧?
'分页设置
total=0

do while (not rs_lar.eof)
c_photo=rs_lar("coun")
total=total+c_photo
     rs_lar.movenext   
     loop

if str="" then ’什么情况下才成立呢?
    rs_lar.PageSize=50
    pages=rs_lar.pagecount
    records=rs_lar.recordcount
    currentpage=request("currentpage")
    if currentpage="" or currentpage<1 then currentpage=1
    currentpage=cint(currentpage)
    if currentpage>pages then currentpage=pages
    rs_lar.absolutepage=currentpage
else
    currentpage=1
    records=0
    pages=1
end if

♂ 死后定当长眠,生前何须久睡。♀
2013-09-25 17:26
快速回复:ASP分页技术问题,查了好久未果,恳求原因!
数据加载中...
 
   



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

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