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> 以下是符合您搜索条件的数据</font>
</p>
</td>
</tr>
<tr>
<td width="991">
<font size="2"><i>第<font color="red"><%=currentpage%></font>页 找到<font color="blue"><%=Records%></font>条记录 共<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">↑</a><a title="按维保日期降序排列" <%if px="j_netname" then%> style="color:red"<%end if%> href="searchout.asp?px=j_netname">↓</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
%>