How to get SQL return code lazarus / 16-Databases ---------------------------------------------------------------------- capslock · 2014-04-05 16:53 How can I get SQL return code using sqldb components (mysql)? SQL databases have a common list of sql return codes, for example -901, -505, etc. I want to get this return code inside an exception block:   try     AQuery.ExecSQL;     Result := AQuery.RowsAffected;   except     on E: EDatabaseError do     begin       if sqlcode = -901 then      // ??????          DoSomething;       else          ...     end;  end; Thanks in advance. ---------------------------------------------------------------------- BigChimp · 2014-04-06 07:51 There could well be an EDatabaseError descendent for your mysql connection which provides this info. There is for Firebird, PostgreSQL etc. ---------------------------------------------------------------------- BigChimp · 2014-04-06 12:10 Had a look at the source code; doesn't look like mysql connector has a specific error descendent. In trunk, however, there's ESQLDatabaseError which has the ErrorCode property...