语法错误 在查询表达式 'ip=221.236.164.23' 中

来源:百度知道 编辑:UC知道 时间:2024/06/16 10:08:10
<%
Dim MyRs,M_ID,MIP,ip,userid,prog_id
prog_id=request("prog_id")
ip=Request("ip")
if ip="" then
Response.Write "ResultCode=1"
Response.end
else
'on error resume next
Set M_ID=con.execute("select * from Movies where ip="&ip&"")
if M_ID.bof and M_ID.eof then
Response.BinaryWrite ResultCode&chrb(hex(ascb("1")))
Response.end
end if
If err.number<>0 then Response.Write "ResultCode=1":Response.end

Response.Write "userid="&M_ID("ID")
end if
%>

Set M_ID=con.execute("select * from Movies where ip="&ip&"")
改成:
Set M_ID=con.execute("select * from Movies where ip='"&ip&"'")
要加单引号的

你这个IP变量最后是字符窜类型的,所以要用引号包含
你可以写成这样
Set M_ID=con.execute("select * from Movies where ip='"&ip&"'")