Capture SQL error
Capture SQL error
I'm using LiteDAC's LiteSQL component to run SQLs to make database updates and have code set to rollback if an error occurs using try..except blocks. That seems to be working well, but I'd also like to capture what the SQL error was but can't find anything that appears to be the error. Is there a way, with LiteSQL or another LiteDAC component, to capture what caused the SQL failure?
Re: Capture SQL error
Hello,
You can use the onError event of the LiteConnection component and the ESQLiteError class:
You can use the onError event of the LiteConnection component and the ESQLiteError class:
Code: Select all
uses ..., LiteError;
...
procedure TForm1.LiteConnection1Error(Sender: TObject; E: EDAError;
var Fail: Boolean);
begin
ShowMessage(ESQLiteError(E).Message);
end;