Free Pascal => Database => Topic started by: af0815 on January 15, 2021, 11:55:35 am

Title: MSSQL howto catch a TMSSQLConnection Error without Messagebox?
Post by: af0815 on January 15, 2021, 11:55:35 am
On my Raspi i got on a TMSSQLConnection a messagebox if the server is not reachable. The connection is not my problem, but i am not able to cach this exeption silent without poping up this messagebox.

The problem is, the messagebox pops up and want an OK or ABORT.
In my code i catch the exception, set a flag and reraise
Code: Pascal  [Select][+][-]
  1.     try
  2.       if IsOk then AConnection.Connected := true;
  3.     except
  4.       on E : Exception do begin
  5.         IsOk:=false;
  6.         raise;
  7.       end;
  8.     end;

The calling function does this
  Result := false;
    Result := true;
    on E : Exception do begin
So the exception should silent catched and i can handle if a connection is ok or not.

How can i avoid this unwanted box
TinyPortal © 2005-2018