Getting Firebird database error codes lazarus / 16-Databases ---------------------------------------------------------------------- talorigomat · 2015-02-26 18:57 I'm using the SQLdb component (TIBConnection) to access a firebird database.  Is there a way of getting the error code which Firebird generates error?  I already know how to get the error message with Code: [Select]try   [i]code which my produce error[/i]   ....... except   on E: EDatabaseError do     ShowMessage(E.Message); end; ---------------------------------------------------------------------- LacaK · 2015-02-26 20:04 try   code which my produce error   ....... except   on E: EIBDatabaseError do     ShowMessageFmt('ErrorCode: %d; Messsge: %s', [E.GDSErrorCode, E.Message]); end; or better: try   code which my produce error   ....... except   on E: ESQLDatabaseError do     ShowMessageFmt('ErrorCode: %d; Messsge: %s', [E.ErrorCode, E.Message]); end; ---------------------------------------------------------------------- talorigomat · 2015-02-26 20:29 Hi LacaK  Thanks for helping with this.  With both examples you gave I received the following error when compiling: Error: identifier idents no member "GDSErrorCode" ---------------------------------------------------------------------- LacaK · 2015-02-27 05:16 Interesting? For me it compiles successfully. May be, that you use some older version of FPC than me ? (I use TRUNK) ---------------------------------------------------------------------- talorigomat · 2015-02-27 05:54 I'm using Lazarus 1.4 RC1 which was released recently. ---------------------------------------------------------------------- LacaK · 2015-02-27 08:25 EIBDatabaseError must have GDSErrorCode member ... check again your program (do not mix ESQLDatabaseError with EIBDatabaseError) ---------------------------------------------------------------------- talorigomat · 2015-03-02 00:51 Thanks LacaK.  Silly me.  I had not changed the "on E: EDatabaseError do"  part of the my code. Many thanks for the help. Just to add I got it to work using : Code: [Select]except   on E: EIBDatabaseError do but not with: except   on E: ESQLDatabaseError do     ShowMessageFmt('ErrorCode: %d; Messsge: %s', [E.ErrorCode, E.Message]); with the latter I get: unit1.pas(89,15) Error: Identifier not found "ESQLDatabaseError" unit1.pas(89,33) Error: class type expected, but got "" ---------------------------------------------------------------------- LacaK · 2015-03-02 07:17 Quote from: talorigomat on March 02, 2015, 01:51:17 ambut not with: except   on E: ESQLDatabaseError do     ShowMessageFmt('ErrorCode: %d; Messsge: %s', [E.ErrorCode, E.Message]); with the latter I get: unit1.pas(89,15) Error: Identifier not found "ESQLDatabaseError" unit1.pas(89,33) Error: class type expected, but got "" May be, that ESQLDatabaseError was not backported to FPC 2.6.4 But with next release of FPC 3.0.0 it will work