更新查询:未终止的字符串常量错误asp

时间:2012-07-13 10:01:22

标签: asp-classic

我在asp经典中工作。我是asp新手,它的语法似乎让我感到困惑。

我有这个代码来更新名为jeanmeasure的表中的数据。

此查询有什么问题?它给出了以下错误:

现在我的代码是

Dim m1,m2,m3,m4,m5,m6,m7,m8,m9,m1d,m2d,m3d,m4d,m5d,m6d,m7d,m8d,m9d 
m1 = Request.QueryString("m1")
m2 = Request.QueryString("m2")
m3 = Request.QueryString("m3")
m4 = Request.QueryString("m4")
m5 = Request.QueryString("m5")
m6 = Request.QueryString("m6")
m7 = Request.QueryString("m7")
m8 = Request.QueryString("m8")
m9 = Request.QueryString("m9")

m1d = Request.QueryString("m1d")
m2d = Request.QueryString("m2d")
m3d = Request.QueryString("m3d")
m4d = Request.QueryString("m4d")
m5d = Request.QueryString("m5d")
m6d = Request.QueryString("m6d")
m7d = Request.QueryString("m7d")
m8d = Request.QueryString("m8d")
m9d = Request.QueryString("m9d")


sql =" UPDATE jeanmeasure SET m1 = "&m1&" , m2 = ,"&m2&", m3 = "&m3&", m4 = "&m4&", m5 = "&m5&",m6 = "&m6&",m7 = "&m7&",m8 = "&m8&",m9 = "&m9&",m1d = "&m1d&", m2d = "&m2d&", m3d = "&m3d&", m4d = "&m4d&",m5d = "&m5d&",m6d = "&m6d&",m7d = "&m7d&", m8d = "&m8d&", m9d = "&m9d&" WHERE id = 1 "
    Response.Write(sql)
     dbobj.execute(sql)

,错误是 语法错误  接近''='m1,m2 =,m2,m3 = m3,m4 =,m5 = m5,m6 = m6,m7 = m7,m8 = m8,m9 = m9,m1d'在第1行

2 个答案:

答案 0 :(得分:1)

看看

m2 = ,"&m2&" 

逗号处于错误位置必须

m2 = "&m2&", 

答案 1 :(得分:0)

您的语法应为:m1 ='“& m1&”',m2 ='“& m2&”',...