简单的ASP查询ACEESS数据库问题,高手请指教,急
<!--#include file="conn.asp"-->
<!--#include file="isadmin.asp"-->
<%
id = trim(request("id"))
tel = trim(request("tel"))
teacher = trim(request("teacher"))
if id = "" then
strquery1 = "true"
else
strquery1 = "id='"&id&"'"
end if
if tel = "" then
strquery2 = "true"
else
strquery2 = "tel='"&tel&"'"
end if
if teacher = "" then
strquery3 = "true"
else
strquery3 = "teacher='"&teacher&"'"
end if
sql = "select * from teacher where "&strquery1&" and "&strquery2&" and "&strquery3
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,1 浏览器提示出错的行
if rs.recordcount < 1 then
rs.close
set rs = nothing
conn.close
set conn = nothing
response.write "<script>alert('没有找到符合条件的用户');history.go(-1);</script>"
response.end
else
%>
只是一个简单的查询,查询3个值ID,TEL和TEACHER,其中数据类型ID是自动编号,TEL是数字,TEACHER是文本。
全部留空查询成功,ID和TEL留空,只填TEACHER时成功,但是填写ID和TEL其中任何一个时就会出错,错误类型:Microsoft JET Database Engine (0x80040E07)
标准表达式中数据类型不匹配。
我是新手,请教下高手到底是怎么回事。