开发者社区> 问答> 正文

关于asp josn 接到参数 执行 sql语句 报错问题

<%
Dim member
Set member = jsObject()
dim dbconnection,uplist,DBPath,SQL,Sort,Lbound,Ubound
Dim id=request("jsoncallback")
set dbconnection=Server.CreateObject("ADODB.Connection") 
DBPath = Server.MapPath("a.mdb")
dbconnection.Open "provider=microsoft.jet.oledb.4.0;data source="&dbpath 
'如果 SQL="select ContentID from Content where ContentID=247"这么写 就能执行
'如果 SQL="select ContentID from Content where ContentID="&id 就出错,页面显示 语法错误,但是我 单独 访问 这个 asp 能运行 不报错
SQL="select ContentID from Content where ContentID=247"
SET uplist=dbconnection.EXECUTE(SQL) 
member("code") = ""&uplist(0)&""
member("errmsg") = "\u5bf9\u8c61ID\u4e0d\u5408\u6cd5"
response.write request.querystring("jsoncallback")&"("&member.jsString&")"
Set member = Nothing
%>

问题:
'如果 SQL="select ContentID from Content where ContentID=247"这么写 就能执行,json 接收正常
'如果 SQL="select ContentID from Content where ContentID="&id 就出错,页面显示 语法错误,但是我 单独 访问 这个 asp 能运行 不报错
这里 sql 我要 获取动态 数值
请 高手帮助 解决下,我实在是 不知道是哪问题了

展开
收起
小旋风柴进 2016-06-07 13:55:38 2257 0
1 条回答
写回答
取消 提交回答
  • where ContentID='"&id&"'

    2019-07-17 19:29:55
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
SQL Server 2017 立即下载
GeoMesa on Spark SQL 立即下载
原生SQL on Hadoop引擎- Apache HAWQ 2.x最新技术解密malili 立即下载