我做数据的多重查询时候,没数据显示,希望大家帮忙解决。
<!--#include file="conn.asp"-->
<html>
<head>
<title>查询</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="css/td.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
set rs1=Server.CreateObject("adodb.recordset")
sql="select * from tj"
rs1.open sql,conn,1,1
%>
<%
set rs2=Server.CreateObject("adodb.recordset")
sql="select * from zy"
rs2.open sql,conn,1,1
%>
<form name="form1" method="post" action="">
<table width="75%" height="32" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr bgcolor="#FFFFFF">
<td width="20%">
<div align="center">请输入您要查询的条件:</div></td>
<td width="80%">了解途径
<select name="tj">
<option value="">了解途径</option>
<%
do while not rs1.eof
%>
<option value=<%=rs1("tj")%><%if rs1("tj")=request("tj") then response.write " selected"%>><%=rs1("tj")%></option>
<%
rs1.movenext
loop
%>
</select>
专业
<select name="zy">
<option value="">专业</option>
<%
do while not rs2.eof
%>
<option value=<%=rs2("zy")%><%if rs2("zy")=request("zy") then response.write " selected"%>><%=rs2("zy")%></option>
<%
rs2.movenext
loop
%>
</select>
<input type="submit" name="Submit" value="提交">
</td>
</tr>
</table>
</form>
<%
if len(request("tj"))=0 or isnull(request("tj")) then
sql=sql&""
else
sql=sql&"and tj='"&request("tj")&"'"
end if
if len(request("zy"))=0 or isnull(request("zy")) then
sql=sql&""
else
sql=sql&" and zy='"&request("zy")&"'"
end if
if request("zy")<>"" then
set rs3=conn.execute("select * from info where zy="&request("zy"))
response.write "<h3><center><font color=red>"&rs3("zy")&"</font></center></h3>"
else
response.write "<center><h3><font color=red>没有你要显示的结果!</font></h3></center>"
end if
%>
<table width="75%" height="59" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr align="center" bgcolor="#FFFFFF">
<td height="25">姓 名</td>
<td>性 别</td>
<td>年 龄</td>
<td>专 业</td>
<td>了解途径</td>
<td>电 话</td>
</tr>
<%do while not rs.eof%>
<tr align="center" bgcolor="#FFFFFF">
<td><%=rs3("name")%></td>
<td><%=rs3("sex")%></td>
<td><%=rs3("age")%></td>
<td><%=rs3("zy")%></td>
<td><%=rs3("tj")%></td>
<td><%=rs3("tel")%></td>
</tr><%
rs.movenext
loop
%>
</table>
<%
rs3.close
set rs3=nothing
conn.close
set conn=nothing
%>
</body>
</html>
没结果显示,错误提示:
请输入您要查询的条件:Microsoft VBScript 运行时错误 错误 '800a01a8'
缺少对象: ''
/chaxun/index.asp,行100