在adoquery中编写sql插入语句的问题。

freeheartgy8 2003-08-21 02:59:44
我刚才用它的sql编辑器写了查询功能可以用了。
但是我用相似的办法写插入功能就提示:
adoquery1:commandtext does not return a result set.
我写的插入代码如下:
adoquery1.close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert power(power,pass,id)');
adoquery1.SQL.Add('values("hehe"+","+"hehe"+","+"hehe")');
adoquery1.open;
可能是我方法错了,但是看帮助里用adoconnection的execute又不会写参数。
请大家帮忙看看。
...全文
46 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
freeheartgy8 2003-08-21
  • 打赏
  • 举报
回复
谢谢,不过还是不行。仍然是 insert into 语句的语法错误提示
delphi0302 2003-08-21
  • 打赏
  • 举报
回复
var sqlstr:string;

sqlstr:='insert into power(power,pass,id) values(''hehe'',''hehe'',''hehe'')';

adoquery1.close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sqlstr);
adoquery1.ExecSQL;

freeheartgy8 2003-08-21
  • 打赏
  • 举报
回复
楼上的,你的话好象没有经过检验就说出来了。不负责任的啊
sy_315 2003-08-21
  • 打赏
  • 举报
回复
adoquery1.close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into power(power,pass,id)');
adoquery1.SQL.Add('values('hehe','hehe','hehe')');
adoquery1.ExecSQL;
用单引
freeheartgy8 2003-08-21
  • 打赏
  • 举报
回复
access数据库,我检查了一下,好象不是名字的故。
sy_315 2003-08-21
  • 打赏
  • 举报
回复
adoquery1.close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into power(power,pass,id) values('hehe','hehe','hehe');
adoquery1.execsql;
madyak 2003-08-21
  • 打赏
  • 举报
回复
什么数据库?
建议更改表名:power,一般它是系统专用的函数!把power字段也要改名
power,pass,id是字符型吗?

你仔细检查一吧!
freeheartgy8 2003-08-21
  • 打赏
  • 举报
回复
用execsql还是出现insert into语句的语法错误提示啊
freeheartgy8 2003-08-21
  • 打赏
  • 举报
回复
出来新的问题:
提示:insert into语句的语法错误
madyak 2003-08-21
  • 打赏
  • 举报
回复
adoquery1.close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into power(power,pass,id)');
adoquery1.SQL.Add('values(''hehe'',''hehe'',''hehe'')');
adoquery1.ExecSQL;//不能用Open
freeheartgy8 2003-08-21
  • 打赏
  • 举报
回复
我试一下。
雨后阳光2000 2003-08-21
  • 打赏
  • 举报
回复
adoquery1.close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into power(power,pass,id)');
adoquery1.SQL.Add('values(''hehe'',''hehe'',''hehe'')');
adoquery1.open;
雨后阳光2000 2003-08-21
  • 打赏
  • 举报
回复
adoquery1.close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into power(power,pass,id)');
adoquery1.SQL.Add('values("hehe","hehe","hehe")');
adoquery1.open;

2,496

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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