干脆我把两个网页都贴出来给大家看吧,有好主意的话,帮忙给出最简代码,嘿嘿,谢谢了!
以下是advanced_query.asp是选择条件的网页,传递到advanced_query_1.asp进行处理
<!--#include file="conn.asp"-->
<SCRIPT src="birthday.js"></SCRIPT>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>高级查询</title>
</head>
<body bgcolor="#0099CC" text="#000000" background="IMAGES/CINMS.GIF">
<h1 align="center"><font size="7"><strong>综合查询</strong></font></h1>
<p><img src="IMAGES/mtdd.gif" alt="说明" width="20" height="20" border="0" /><font color="#2100DB">说明:</font></p>
<p>
</p>
<form method="POST" action="advanced_query_1.asp">
<p>设 备:<select size="1" name="设备">
<option selected>请选择</option>
<option value="GZ-BR1">GZ-BR1</option>
<option value="GZ-BR2">GZ-BR2</option>
<option value="GZ-AR1">GZ-AR1</option>
<option value="GZ-AR2">GZ-AR2</option>
<option value="GZ-AR3">GZ-AR3</option>
<option value="GZ-AS1">GZ-AS1</option>
<option value="GZ-AS2">GZ-AS2</option>
</select></p>
<p>告警信息:<select size="1" name="info">
<% Set rs = Server.CreateObject ("ADODB.Recordset")
sql="Select 告警信息 from info"
rs.Open sql,conn,1,2
%>
<option selected>请选择</option>
<% rs.movefirst
dim x
do while not rs.eof
x=rs("告警信息")
%>
<option value="<% =x%>"><% =x%></option>
<%rs.movenext
loop
%>
<%
rs.close
Set rs = Nothing
conn.close
set conn=Nothing
%>
</select></p>
<p>开始时间: 结束时间:</p>
<p>故障原因:<input type="text" name="reason" size="20"></p>
<p>维 护 区:<input type="text" name="maintain" size="20"></p>
<p>处 理 人:<input type="text" name="solution" size="20"></p>
<p>客户名称:<input type="text" name="customer" size="20"></p>
<div style="position: absolute; width: 90px; height: 15px; z-index: 1; left: 91px; top: 210px" id="layer1">
<input onfocus="show_cele_date(birthday,'','',birthday)" name="birthday" size="12"></div>
<div style="position: absolute; width: 90px; height: 15px; z-index: 2; left: 272px; top: 211px" id="layer2">
<input onfocus="show_cele_date(birthday1,'','',birthday1)" name="birthday1" size="12"></div>
<p align="center"><input type="submit" value="提交" name="B1"> <input type="reset" value="重置" name="btnReset"></p>
</form>
</body>
</html>
以下是advanced_query_1.asp
<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>高级查询结果</title>
</head>
<body bgcolor="#0099CC" text="#000000" background="IMAGES/CINMS.GIF">
<table cellSpacing=0 borderColorDark=#ffffff cellPadding=4 width='100%' borderColorLight=#aaaaaa border=1">
<%
session("wds")=request.form("birthday")
session("wde")=request.form("birthday1")
session("wequ")=request.form("设备")
session("winfo")=request.form("info")
session("wres")=request.form("reason")
session("wmain")=request.form("maintain")
session("wslo")=request.form("solution")
session("wcus")=request.form("customer")
dim a,b,c,d,e,f,g,h,i
a=session("wds")
b=session("wde")
c=session("wequ")
d=session("winfo")
e=session("wres")
f=session("wmain")
g=session("wslo")
h=session("wcus")
Set rs = Server.CreateObject ("ADODB.Recordset")
if a="" then response.redirect"error.htm"
else if b="" then sql="Select * from data where 开始日期='"&a&"'"
else if b<>"" then sql="Select * from data where 开始日期 between '"&a&"' and '"&b&"'"
else
{
if c<>"请选择" then
sql=sql&" and 设备='"&c&"'"
end if
if d<>"请选择" then
sql=sql&" and 主要告警信息='"&d&"'"
end if
if e<>"" then
sql=sql&" and 故障原因='"&e&"'"
end if
if f<>"" then
sql=sql&" and 维护区='"&f&"'"
end if
if g<>"" then
sql=sql&" and 处理人='"&g&"'"
end if
if h<>"" then
sql=sql&" and 客户名称='"&h&"'"
end if
}
end if
rs.Open sql,conn,1,2
%>
<% dim gzcount
gzcount=rs.RecordCount
if gzcount=0 then
response.write"抱歉,没有相关数据!"
end if
%>
<tr bgcolor=#006c6c>
<td colspan=<%=rs.Fields.Count+1 %>.><%Response.Write "<b><font color=white>共"&gzcount&"条纪录 当前时间"&CStr(now)&"</font></b>"%></td>
</tr>
<tr bgcolor="#ffffaf">
<!--#include file="table.inc"-->
<form method="POST" action="advanced_query_2.asp" name="FrontPage_Form1" onsubmit="return FrontPage_Form1_Validator(this)">
<p align="right"><font size="2" face="宋体">
<a href="advanced_query_2.asp?iPage=0&OldPageNo=<%=PageNo%>">第一页</a>
<a href="advanced_query_2.asp?iPage=1&OldPageNo=<%=PageNo%>">上一页</a>
<a href="advanced_query_2.asp?iPage=2&OldPageNo=<%=PageNo%>">下一页</a>
<a href="advanced_query_2.asp?iPage=3&OldPageNo=<%=PageNo%>">最后一页</a> 第
<input type="text" name="PageIn" size="4" value=<%=PageNo%>>页,页数:</font><font size="2"><%=PageNo%>/<%=rs.PageCount%></font></p>
<input type="hidden" name="OldPageNo" value="<%=PageNo%>">
</form>
<%
rs.close
Set rs = Nothing
conn.close
set conn=Nothing
%>
</body>
</html>