delphi2010 编译时出现EDatabaseError with message 'Missing SQL property'错误,哪位高人给指点一下。 5
我的ADOQuery2.SQL里添加了select*fromcontainerinfo;,ADOQuey3的SQL里已经添加了select*frompackingcont...
我的ADOQuery2.SQL里添加了select * from containerinfo;,ADOQuey3的SQL里已经添加了select * from packingcontainer;
具体代码如下:
procedure TForm1.Label21Click(Sender: TObject);
var
ist : tadoquery;
begin
ADOQuery2.first;
ist := tadoquery.create(self);
ist.connection := adoconnection2;
while not ADOQuery2.eof do
begin
if not dbgrideh2.selectedrows.currentrowselected then
begin
ist.close;
ist.SQL.clear;
adoquery3.open;
adoquery3.active:=true;
ist.SQL.add('insert into packingcontainer(slt,id,name) values(:slt,:id,:name);');
ist.execSQL;
ist.SQL.clear;
adoquery3.edit; dbgrideh3.datasource.dataset.fieldbyname('slt').value:=dbgrideh2.datasource.dataset.fieldbyname('slt').Asboolean; dbgrideh3.datasource.dataset.fieldbyname('id').value:=dbgrideh2.datasource.dataset.fieldbyname('id').asinteger; dbgrideh3.datasource.dataset.fieldbyname('name').value:=dbgrideh2.datasource.dataset.fieldbyname('name').AsString;
ist.execSQL();
end;
ADOquery2.next;
end;
adoquery3.close;
end; 展开
具体代码如下:
procedure TForm1.Label21Click(Sender: TObject);
var
ist : tadoquery;
begin
ADOQuery2.first;
ist := tadoquery.create(self);
ist.connection := adoconnection2;
while not ADOQuery2.eof do
begin
if not dbgrideh2.selectedrows.currentrowselected then
begin
ist.close;
ist.SQL.clear;
adoquery3.open;
adoquery3.active:=true;
ist.SQL.add('insert into packingcontainer(slt,id,name) values(:slt,:id,:name);');
ist.execSQL;
ist.SQL.clear;
adoquery3.edit; dbgrideh3.datasource.dataset.fieldbyname('slt').value:=dbgrideh2.datasource.dataset.fieldbyname('slt').Asboolean; dbgrideh3.datasource.dataset.fieldbyname('id').value:=dbgrideh2.datasource.dataset.fieldbyname('id').asinteger; dbgrideh3.datasource.dataset.fieldbyname('name').value:=dbgrideh2.datasource.dataset.fieldbyname('name').AsString;
ist.execSQL();
end;
ADOquery2.next;
end;
adoquery3.close;
end; 展开
1个回答
2012-07-05 · 知道合伙人软件行家
关注
展开全部
ist.SQL.clear;//已经清掉语句
adoquery3.edit; dbgrideh3.datasource.dataset.fieldbyname('slt').value:=dbgrideh2.datasource.dataset.fieldbyname('slt').Asboolean; dbgrideh3.datasource.dataset.fieldbyname('id').value:=dbgrideh2.datasource.dataset.fieldbyname('id').asinteger; dbgrideh3.datasource.dataset.fieldbyname('name').value:=dbgrideh2.datasource.dataset.fieldbyname('name').AsString;
ist.execSQL();//又执行了,不报错才怪呢
adoquery3.edit; dbgrideh3.datasource.dataset.fieldbyname('slt').value:=dbgrideh2.datasource.dataset.fieldbyname('slt').Asboolean; dbgrideh3.datasource.dataset.fieldbyname('id').value:=dbgrideh2.datasource.dataset.fieldbyname('id').asinteger; dbgrideh3.datasource.dataset.fieldbyname('name').value:=dbgrideh2.datasource.dataset.fieldbyname('name').AsString;
ist.execSQL();//又执行了,不报错才怪呢
追问
这位大侠,那怎么改啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询