偶还是搬help中的句子吧:Delphi syntax: function ExecSQL: Integer;Description Call ExecSQL to execute the SQL statement currently assigned to the SQL property. Use ExecSQL to execute queries that do not return a cursor to data (such as INSERT, UPDATE, DELETE, and CREATE TABLE).ExecSQL returns an integer value reflecting the number of rows affected by the executed SQL statement. 可以这样写 qry1.Close; qry1.SQL.Clear; qry1.SQL.Add('update student set age=1');//(mmo1.Lines.Text); i := qry1.ExecSQL; if (i>0) then begin str := '成功执行了查询,影响到'+IntToStr(i)+'行' ShowMessage(str ) ; end;
function ExecSQL: Integer;Description
Call ExecSQL to execute the SQL statement currently assigned to the SQL property. Use ExecSQL to execute queries that do not return a cursor to data (such as INSERT, UPDATE, DELETE, and CREATE TABLE).ExecSQL returns an integer value reflecting the number of rows affected by the executed SQL statement.
可以这样写 qry1.Close;
qry1.SQL.Clear;
qry1.SQL.Add('update student set age=1');//(mmo1.Lines.Text);
i := qry1.ExecSQL; if (i>0) then
begin
str := '成功执行了查询,影响到'+IntToStr(i)+'行'
ShowMessage(str ) ;
end;