注册 登录
编程论坛 Delphi论坛

好奇怪的update错误

aaron52088 发布于 2007-05-18 18:38, 1825 次点击
adoqueryOP.SQL.Clear;
adoqueryOP.SQL.Text:='update 管理员 set xm=:a,password=:b,type=:c,tel=:d,addr=:e where id=:id';
adoqueryOP.Parameters.ParamByName('id').Value:=editOPID.Text;
adoqueryOP.Parameters.ParamByName('a').Value:=editOPxm.Text;
adoqueryOP.Parameters.ParamByName('b').Value:=editOPpassword.Text;
adoqueryOP.Parameters.ParamByName('c').Value:=combobox1.Text;
adoqueryOP.Parameters.ParamByName('d').Value:=editOPtel.Text;
adoqueryOP.Parameters.ParamByName('e').Value:=editOPaddr.Text;
adoqueryOP.ExecSQL;
showmessage('修改成功');
以下是管理员表的数据库设计:
只有本站会员才能查看附件,请 登录

会出现这个错误:
只有本站会员才能查看附件,请 登录


写了好多次了,好像并没有什么错啊,大家看看,帮帮忙的,谢谢先:)
10 回复
#2
autosun2007-05-19 08:05
打印一下SQL语句,看看是不是有语法错误!!~~
#3
autosun2007-05-19 08:07
好像没有“)” 还有就是“''”的问题!~
#4
nongen2007-05-19 09:01

你的字段类型都是文本。。。。


abcde定义?

[此贴子已经被作者于2007-5-19 9:08:48编辑过]

#5
aaron520882007-05-20 14:53
谢谢大家先。
我用showmessage(adoqueryop.sql.text)显示的是我上面写的语句,
abcde不需要定义的吧?
#6
sgliuxiu2007-05-20 16:55
你那些数据类型都是文本吗?不是字符型的?
还有,如果用同样的语句,对英文名的数据表有没有这样的错误?
#7
aaron520882007-05-20 22:38

ACCESS数据库中的文本不是字符的意思吗?
我很奇怪的是,这样的数据库设置,Insert可以实现,
就是在修改上出问题的。
楼上说的对英文名的数据表有没有错误,我不是很明白什么意思的
谢谢大家

#8
wzh7060962007-05-21 07:11

设置一下ADOQueryOP的Paramaters中各项的内容和长度

#9
aaron520882007-05-23 01:13

请问下,怎么设置呢?

#10
rosege2008-11-25 08:06
我也被这样的问题纠缠着,希望在这里一并得到解答。
谢谢
#11
kinsey08032012-07-19 09:12
同样的代码,这样写是否更清晰?
adoqueryOP.Close;
adoqueryOP.SQL.Clear;
adoqueryOP.SQL.Text:= 'update 管理员'
+ 'set xm = ' + QuotedStr(editOPxm.Text)
+ ', password = '+ QuotedStr(editOPpassword.Text)
+ ', type = ' + QuotedStr(combobox1.Text)
+ ', tel = ' + QuotedStr(editOPtel.Text)
+ ', addr = ' + QuotedStr(editOPaddr.Text)
+ ' where id = ' + QuotedStr(editOPID.Text);
adoqueryOP.ExecSQL;
showmessage('修改成功');
1