Topic: OnSQLException - Control MySQL Errors
Hello Dmitry and MVD Lovers,
I'm using the following function provided by Dmitry to control error message on MySQL Connection and Queries.
It works fine but at the second attempt it starts again with the system error messages.
Any Help?
function OnSQLException(Sender: TObject; Msg: string; SQL: string): boolean;
begin
// how to catch lost connection for MySQL
if Pos('Lost connection to MySQL server during query', Msg)=1 then
//if Pos('Lost connection to MySQL server during query', Msg)=1 then
begin
result := True; // to prevent system message
// Own message
MessageBox('Lost connection. Please try again.', 'Error', MB_OK+MB_ICONWARNING);
end;
end;
Thanks