EDatabaseError not raised

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

EDatabaseError not raised

Post by LHSoft » Wed 29 Jun 2016 13:24

Hello,
I tried to open a table where one field missing in table of Database.
Data.DB correctly raises the EDatabaseError in

Code: Select all

procedure DatabaseError(const Message: string; Component: TComponent = nil);
but this error does not arrive in your TLiteConnection.onError.

Shouldn't be that handled in OnError of TLiteConnection?

best regards
Hans

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

Re: EDatabaseError not raised

Post by AlexP » Thu 30 Jun 2016 12:32

Hello,

If the number of fields or their types don't match, then the error is generated not by the database, but by Delphi using a usual method Raise. Therefore the onError event doesn't occur, since it works with errors generated by the database. If you need to handle this error, you can use a try...except block.

Post Reply