我的SQL查询语法错误出面在哪里呢?

来源:百度知道 编辑:UC知道 时间:2024/06/19 11:51:15
我的查询语句 Set insertinfo = tdb.OpenRecordset("update myinfo set allcontent= '" & allinfo & "' where id='" & i & "'") 为什么总出现语法错误提示呢?

update是不返回数据集的操作,所以不应该用OpenRecordset的方法来执行
OpenRecordset应该用select ...
可以用
tdb.execute("update myinfo set allcontent= '" & allinfo & "' where id='" & i & "'", dbDenyWrite)
这样的方法来执行不返回数据集的SQL,如Insert、Update、Delete
以上语法为VB6中的,具体到你的环境中请自己更改一下,另外如上面的朋友所讲的,注意一下类型是否正确,如果不是字符类的字段,值是不需要用引号'括起来的

"update myinfo set allcontent= '" & allinfo & "' where id=" & i
估计你这个id不是字符型

语法错误:!?
你好象掉了连接符号 ‘+’ 吧