求大神纠错啊!!在线等。。
本人最近在维护一个asp的网站,奈何不怎么熟悉,求大神指导。下面的代码,打开网页报500错误,我知道是sql语句拼接的问题,可我找度娘问了好几次,都弄不对。无奈中,只能求助各位大神了。。
求错误原因和修改办法,虽然我不是搞asp的,但多会点知识也不压身啊。在线等,有点急。。。有结果马上结贴!
asp sql 字符串拼接
<%
user_name=""
user_job_number=""
user_id_number=""
If IsEmpty(request.Form("user_name")) Then
user_name="or name like '%" & request.Form("user_name") & "%'"
End If
If IsEmpty(request.Form("user_job_number")) Then
user_job_number="or job_number like '%" & request.Form("user_job_number") & "%'"
End If
If IsEmpty(request.Form("user_id_number")) Then
user_id_number="or id_number like '%" & request.Form("user_id_number") & "%'"
End If
set rs=server.CreateObject("adodb.recordset")
sql="select * from people where 1=1" & user_name & user_job_number & user_id_number
rs.open sql,conn,1,1
if rs.eof then
response.Redirect("index.asp")
response.end()
end if
rs.close
set rs=nothing
%>