Capture SQL error

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 11
Joined: Wed 21 May 2014 17:07

Capture SQL error

Post by nszmnsky » Sat 18 Apr 2015 20:09

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?

Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Capture SQL error

Post by AlexP » Mon 20 Apr 2015 10:58


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);

Post Reply