我想把SQL中UPDATE,或INSERT的执行结果提示在DELPHI中显示,请问How做?
如:“成功执行了查询”
或 “影响到4行”等执行结果提示取出来,请问应该怎样做?

解决方案 »

  1.   

    偶还是搬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;