我刚才用它的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又不会写参数。
请大家帮忙看看。
但是我用相似的办法写插入功能就提示:
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又不会写参数。
请大家帮忙看看。
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into power(power,pass,id)');
adoquery1.SQL.Add('values("hehe","hehe","hehe")');
adoquery1.open;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into power(power,pass,id)');
adoquery1.SQL.Add('values(''hehe'',''hehe'',''hehe'')');
adoquery1.open;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into power(power,pass,id)');
adoquery1.SQL.Add('values(''hehe'',''hehe'',''hehe'')');
adoquery1.ExecSQL;//不能用Open
提示:insert into语句的语法错误
建议更改表名:power,一般它是系统专用的函数!把power字段也要改名
power,pass,id是字符型吗?你仔细检查一吧!
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into power(power,pass,id) values('hehe','hehe','hehe');
adoquery1.execsql;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into power(power,pass,id)');
adoquery1.SQL.Add('values('hehe','hehe','hehe')');
adoquery1.ExecSQL;
用单引
adoquery1.SQL.Clear;
adoquery1.SQL.Add(sqlstr);
adoquery1.ExecSQL;