How to view the SQL error message in a Delphi's DBX transaction?
Question
I've seen this somewhere in SO some time ago, but I couldn't find it now.
I remember that one of the error events in some component (TSQLDataSet, TDataSetProvider, TClientDataSet or else) would give me the error message as returned by the database server itself, but I cannot recall it.
Does someone knows what I am talking about?
Thanks in advance.
Solution
TClientDataSet.OnReconcileError contains a parameter of type EReconcileError which includes the error message, context and code. This data contains the message from the database server.
OTHER TIPS
Of course EReconcileError only helps if that is the particular type of database error you have. For all errors first look at the E.Messaage string, which gives you a description of the problem. Not always the same as the exact server text i think - it dpends also which database driver you are using - I am more familiar with the TMySQLConnection, but it's still a DBExpress driver... Chris