这样不可以事先模糊查询,为什么啊,sql 语句有错吗?

Set Myconn=Server.CreateObject("ADODB.Connection")
Myconn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("studentdb.mdb")

sql="select * from student where name Like '%" & Request.Form("name") & "%' "
set RS= Myconn.Execute (sql)

if rs.eof then
response.write("对不起,没有此学生的记录!") %>

set rs=nothing
Myconn.close
Set Myconn=Nothing

else
response.write rs.fields("name")

set rs = nothing
Myconn.close
set myconn=nothing
end if
这样不可以事先模糊查询,为什么啊,sql 语句有错吗?
---------------------------------------------------------------

sql="select * from student where [name] Like '%"&Request.Form("name")&"%'"
---------------------------------------------------------------

有什么错误提示?帖出来看看

Published At
Categories with Web编程
comments powered by Disqus