我正在连接不同的值,我得到以下 sql 语句:
INSERT INTO Ads (Position, Type, AdType, Link, Width, Height, Path, Korder ) VALUES ('left','1','left1','',1024,768,'FILE1',1)
我真的在这里看不到任何错误,但是,它告诉我
Microsoft JET 数据库引擎错误“80040e14”
INSERT INTO 语句中的语法错误。
/adm/uploadAdPic.asp,第 68 行
sql="INSERT INTO Ads (Position, Type, AdType, Link, Width, Height, Path, Korder )"
sql=sql & " VALUES "
sql=sql & "('" & position & "',"
sql=sql & "'" & adType & "',"
sql=sql & "'" & position & adType & "',"
sql=sql & "'" & link & "',"
sql=sql & "" & width & ","
sql=sql & "" & height & ","
sql=sql & "'" & path & "',"
//sql=sql & "" & korder & ","
sql=sql & "" & korder & ")"
//sql=sql & "0)"
Response.Write(sql)
//on error resume next
conn.Execute sql,recaffected //THIS IS LINE 68
请你帮我找出语法错误。
编辑:我自己找到了解决方案,但它也包含在下面的答案中。位置是保留字。我试图修改我的插入语句删除不同的字段,我发现 Position 字段出错。所以我将 Position 重命名为 VertPos 并且它可以工作。