<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<%
n1=request.form("n1")
n2=request.form("n2")
if n2= "ID" then
n1=cdbl(n1)
end if
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("access1.mdb")%>
<form name="form1" method="post" action="chaxun1.asp">
搜索:<br>
<input type="text" name="n1">
<select name="n2" multiple size="2">
<option value="ID">编号</option>
<option value="name">姓名</option>
<option value="tel">电话</option>
<option value="passowrod">密码</option>
<option value="adss">地址</option>
<option value="youbian">邮编</option>
<option value="shengri">生日</option>
</select>
<br>
<input type="submit" name="Submit" value="提交">
<input type="reset" name="reset" value="重置">
</form>
<%set rs=server.createobject("adodb.recordset")
if n2<>"ID" then
exec="select *from ziliao1 where '"&n2&"'='"&n1&"'"
else
exec="select *from ziliao1 where "&n2&"="&n1
end if
rs.open exec,conn,3,1
%>
<% if n2="ID" then
do while not rs.eof and n1<>0
response.Write(rs("ID"))
response.write(rs("name"))
rs.movenext
response.End
loop
else
do while not rs.eof and n1<>""
response.Write(rs("ID"))
response.write(rs("name"))
rs.movenext
response.End
loop
end if
rs.close
conn.close
%>
</body>
</html>
这个程序在运行的只有ID是可以进行查询的,但是其他的查询方法就无效了,不知道是为什么,还请个位大哥,大姐帮个忙啦!!!!!