AnyDAC
ContentsIndexHome
PreviousUpNext
EADDBEngineException.SQL Property

Return a failed SQL command text.

Group
Links

Use SQL property value to get a SQL command text, for which DBMS returned an error. 

This property together with the Params property may be used for the debugging purposes.

property SQL: String;
try
  Log('Removing records');
  ADQuery1.ExecSQL('delete from tab');
  ....
  Log('Inserting records');
  ADQuery1.ExecSQL('insert into tab ...');
except
  on E: EADDBEngineException do begin
    Log(E.Message);
    Log('Failed SQL: ' + E.SQL);
    Log('Failed params: ' + E.Params.Text);
    raise;
  end;
end;
What do you think about this topic? Send feedback!