adotquery中如何实现添加?

ssyuwn 2001-11-15 09:24:48
代码如下:不能执行?
var bid1:integer;
name1,sex1,address1,phone1,job1,area1,photo1:string;
begin
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('insert into lsgxx'+'(bid,name,sex,address,phone,job,area,photo)'
+ 'value'+'(:bid1,:name1,:sex1,:address1,:phone1,:job1,:area1,:photo1)')
(不执行处!)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
adoquery1.Parameters.ParamByName('bid1').Value:=strtoint(edit2.text);
adoquery1.Parameters.ParamByName('name1').Value:=edit3.Text;
adoquery1.Parameters.ParamByName('sex1').Value:=combobox2.Text;
adoquery1.Parameters.ParamByName('address1').Value:=edit4.Text;
adoquery1.Parameters.ParamByName('phone1').Value:=edit5.Text;
adoquery1.Parameters.ParamByName('job1').Value:=combobox4.Text;
adoquery1.Parameters.ParamByName('area1').Value:=combobox3.Text;
adoquery1.Parameters.ParamByName('photo1').Value:=nill;
adoquery1.Post;
...全文
100 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
bbdog 2001-11-15
  • 打赏
  • 举报
回复
gzgz
MaxFoAI 2001-11-15
  • 打赏
  • 举报
回复
var bid1:integer;
name1,sex1,address1,phone1,job1,area1,photo1:string;
begin
bid1:=strtoint(edit2.text);
name1:=edit3.Text;
sex1:=combobox2.Text;
address1:=edit4.Text;
phone1:=edit5.Text;
job1:=combobox4.Text;
area1:=combobox3.Text;
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('insert into lsgxx '+'(bid,name,sex,address,phone,job,area,photo)');
adoquery1.sql.add('value'+'('+bid1+','''+name+''''+','''+sex1+''''+','''+address1+''''+','''+phone1+''''+','''+job1+''''+','''+area1+''''+','+')');
缺少空格,缺少分号

adoquery1.execsql;
taxi 2001-11-15
  • 打赏
  • 举报
回复
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('insert into lsgxx'+'(bid,name,sex,address,phone,job,area,photo)'
+ 'value'+'(:bid1,:name1,:sex1,:address1,:phone1,:job1,:area1,:photo1)')
(不执行处!)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
adoquery1.Parameters[0].Value:=strtoint(edit2.text);
adoquery1.Parameters[1].Value:=edit3.Text;
adoquery1.Parameters[2].Value:=combobox2.Text;
adoquery1.Parameters[3].Value:=edit4.Text;
adoquery1.Parameters[4].Value:=edit5.Text;
adoquery1.Parameters[5].Value:=combobox4.Text;
adoquery1.Parameters[6].Value:=combobox3.Text;
adoquery1.Parameters[7].Value:=nill;
adoquery1.execsql;

5,930

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧