注意:字符串变量在SQL语句中的用法
if application.messagebox('确实要保存所作的修改吗?','提示',MB_OKCANCEL + MB_ICONQUESTION)=idok then
begin
adoquery1.close;
adoquery1.sql.Clear;
str:='update tbdep set tel='''+edit3.text+''',';
str:=str+'unitname='''+edit4.text+''',';
str:=str+'servername='''+edit5.text+''',';
str:=str+'serverip='''+edit6.text+''',';
str:=str+'logid='''+edit7.text+''',';
str:=str+'logpass='''+edit8.text+'''';
str:=str+' '+'where depno='+edit1.text;
adoquery1.sql.add(str);
try
adoquery1.ExecSQL;
application.MessageBox('修改成功!','提示',mb_ok+mb_iconinformation);
except
application.MessageBox('修改失败!','提示',mb_ok+mb_iconinformation);
end;
end;
end;
if application.messagebox('确实要保存所作的修改吗?','提示',MB_OKCANCEL + MB_ICONQUESTION)=idok then
begin
adoquery1.close;
adoquery1.sql.Clear;
str:='update tbdep set tel='''+edit3.text+''',';
str:=str+'unitname='''+edit4.text+''',';
str:=str+'servername='''+edit5.text+''',';
str:=str+'serverip='''+edit6.text+''',';
str:=str+'logid='''+edit7.text+''',';
str:=str+'logpass='''+edit8.text+'''';
str:=str+' '+'where depno='+edit1.text;
adoquery1.sql.add(str);
try
adoquery1.ExecSQL;
application.MessageBox('修改成功!','提示',mb_ok+mb_iconinformation);
except
application.MessageBox('修改失败!','提示',mb_ok+mb_iconinformation);
end;
end;
end;
解决方案 »
- 一个端口是不是可以产生多个socket?
- 加急!delphi同时访问两个不同字符集数据库的问题!问题解决另开贴加100分!
- BookMark 使用速度问题
- 救命啊!!!我要晕死了~~~关于用LOOKUP或locate在Oracle中查找记录的问题!
- 跪求【把程序载入内存执行的代码】内详.所有分都给你!
- 谁能讲讲消息的概念
- 如何獲得聚焦??
- 字体与颜色问题?
- 请问怎样获取SQL数据库中的表名或视图名?程序中怎样调用或更改输入法?
- 菜鸟问题:一Byte最多能表示多大的十进制数
- 我找到了一个Gis控件(For Delphi,VB)
- 在使用INI文件的时候怎么才能给文件添加内容,而我做的却是每一次都重写?
错误提示:号码的语法错误,在查询表达式"10.234.213.5“中
在adoquery1.execsql中出错。
错误提示:标准表达式中数据类型不匹配。