procedure TForm1.Button1Click(Sender: TObject); begin with adoquery1 do begin close; sql.Clear; sql.Add('Update bill set bill_date = ''2004-02-02'''); adoquery1.ExecSQL; //sql.Clear; //sql.Add('select @@affectcount as count') ; //open; edit1.text := inttostr(adoquery1.RowsAffected); end ; end;
ADOQuery1.ExecSQL本身返回的就是语句执行的记录数,你可以用 var total:integer;... total:=ADOQuery1.ExecSQL; ShowMessage(inttostr(total)); 来试试
begin
with adoquery1 do
begin
close;
sql.Clear;
sql.Add('Update bill set bill_date = ''2004-02-02''');
adoquery1.ExecSQL;
//sql.Clear;
//sql.Add('select @@affectcount as count') ;
//open;
edit1.text := inttostr(adoquery1.RowsAffected);
end ;
end;
var total:integer;...
total:=ADOQuery1.ExecSQL;
ShowMessage(inttostr(total));
来试试
返回的就是所影响的记录数。