with InsertQry do begin
Close;
Sql.Clear;
sql.Text := 'select * from AB where times='+trim(edit1.Text);
open;
end;
if InsertQry.RecordCount>0 then begin
with InsertQry do begin
Close;
Sql.Clear;
sql.Text := 'delete * from AB where times='+trim(edit1.Text); //执行这一句为何报错啊
open;
end;
end;
Close;
Sql.Clear;
sql.Text := 'select * from AB where times='+trim(edit1.Text);
open;
end;
if InsertQry.RecordCount>0 then begin
with InsertQry do begin
Close;
Sql.Clear;
sql.Text := 'delete * from AB where times='+trim(edit1.Text); //执行这一句为何报错啊
open;
end;
end;
Close;
Sql.Clear;
sql.add('select * from AB where times='+trim(edit1.Text));
open;
end;
if InsertQry.RecordCount>0 then begin
with InsertQry do begin
Close;
Sql.Clear;
sql.add('delete * from AB where times='+trim(edit1.Text)); //执行这一句为何报错啊
execsql;
end;
end;
Close;
Sql.Clear;
sql.Text := 'delete * from AB where times='+Quotedstr(trim(edit1.Text)); // execsql;
end;
Close;
Sql.Clear;
sql.Text := 'delete * from AB where times='+Quotedstr(trim(edit1.Text));
execsql;
end;
with InsertQry do begin
Close;
Sql.Clear;
sql.Text := 'delete * from AB where times='''+(trim(edit1.Text))+'''';
execsql;
end;
InsertQry.First;
InsertQry.Delete;
end;
我再试一下这样
用execsql;
Close;
Sql.Clear;
sql.Text := 'select * from AB where times=times='''+trim(edit1.Text)+''' ';
open;
end;
if InsertQry.RecordCount>0 then begin
with InsertQry do begin
Close;
Sql.Clear;
sql.Text := 'delete * from AB where times='''+trim(edit1.Text)+''' ';
execsql; end;
end;
with InsertQry do begin
Close;
Sql.Clear;
sql.Text := 'delete * from A1 where times='+trim(timestimes.Text);
open;
end;
//这里执行删除没有问题with InsertQry do begin
Close;
Sql.Clear;
sql.Text := 'delete * from A2 where times='+trim(timestimes.Text);
open;
end;
//这里执行删除也没有问题with InsertQry do begin
Close;
Sql.Clear;
sql.Text := 'delete * from AB where times='+trim(timestimes.Text);
open;
end;
//这里执行删除就出问题了。
表和表之单都是独立的,真是搞不懂啊,提示:InsertQry:CommandText does not return a result set
delete 语句 不能用 open;
用execsql;
谢谢你,你是正确的!!!!多谢!