在VB中,为什么老是会出现操作符丢失的问题,用的是ACCESS数据库

来源:百度知道 编辑:UC知道 时间:2024/04/27 16:58:19
语句如下:
sel = "update yuangong set 姓名='" + xingming.Text + "' from yuangong where 职工编号='" + List1.Text + "'"
con.Execute sel
这样也不行
sel = "update yuangong set 姓名=" + xingming.Text + " from yuangong where 职工编号=" + List1.Text
con.Execute sel
实在不知道错误在哪里了,
另外想知道如果数据字段类型钓为文本,这会有什么影响吗?(关于是否要单引号)

你的sql语句格式是错的!~

UPDATE 表 SET 字段1=" & val(TEXT1.TEXT) & ",字段2='" & Text2.Text &"'" WHERE 条件

其中字段1是数值型 字段2是字符型

就这一句sql有问题:
改为:
sel = "update yuangong set 姓名=" + xingming.Text + " where 职工编号=" + List1.Text

update table set column=value where…