Getting Error number With TMySQL56Connection lazarus / 16-Databases ---------------------------------------------------------------------- Hicheras · 2015-08-09 16:59 Hi ! I'm pretty new to Lazarus but i spent a lot of time with Delphi XE series I'm trying to rewrite my software into Lazarus but i'm stuck with the error handling of MySql. I use the default components TMySQL56Connection, SQLQuery and SQLTransaction but i'm unable to get the error number when i get one. I really like to have a specific error message for every error occurring. With TMySQL56Connection i only get EDatabaseError when the server is inaccessible or when credentials are incorrect. I can't see the difference. With Delphi i was able to get the error number thus handling them correctly and in a very user friendly manner. There was Error 2003 when the software is unable to contact the server and 1045 when credential were incorrect for example. Is it anyway i could find the last error number each time an exception if raised with the MySql Connnection ? Thanks you ---------------------------------------------------------------------- LacaK · 2015-08-09 17:28 There is a bit different situation in TRUNK (3.0.1 version) All MySQL errors are raised as class ESQLDatabaseError, which has ErrorCode and SQLState members. But I am not sure if connection errors will be reported correctly, seems that there is bug. ---------------------------------------------------------------------- Hicheras · 2015-08-09 18:24 Humpf. I don't really want to use the Trunk version... Is there any way to accomplish that in the current release ? If no, my error handling will wait for a next release Thank you for your answer ! :p EDIT : And i'm using Lazarus on Windows. I don't even know if i can use the TRUNK version ---------------------------------------------------------------------- LacaK · 2015-08-10 07:14 Quote from: Hicheras on August 09, 2015, 08:24:03 pmI don't really want to use the Trunk version... Is there any way to accomplish that in the current release ? I do not see such way. As connection failure sets connection handle to Nil so you can not use later this handle to "manualy" obtain error code. Quote from: Hicheras on August 09, 2015, 08:24:03 pmEDIT : And i'm using Lazarus on Windows. I don't even know if i can use the TRUNK version Yes you can. No problem. You can download precompiled trunk version for example from http://www.getlazarus.org/