I'm trying to use ESQLDatabaseError to catch the error code and message from a Firebird database but am having no joy. I'm using the following code:
try
dmMain.qrySite.ApplyUpdates();
dmMain.trnMain.Commit;
except
on E:ESQLDatabaseError do
begin
ShowMessageFmt('ErrorCode: %d; Message: %s', [E.ErrorCode, E.Message]);
end;
if I use DatabaseError exception as
try
dmMain.qrySite.ApplyUpdates();
dmMain.trnMain.Commit;
on E:EDatabaseError do
begin
ShowMessage(E.Message);
end;
end;
Then I can catch the exceptions, however this form doesn't give me the databases sql error code.
I'm using the SQLDB components to access the database and I'm using Lazarus 1.8.0 RC4 with MS Windows 10.