[Lazarus] MSSQL howto catch a TMSSQLConnection Error without Messagebox?

Andreas Frieß friess at gmx.at
Wed Jan 27 15:57:26 CET 2021


Hi Michael,

no, i did not re-raise there.

I want only a silent flag. This should done by the Result:= false in the
calling function.

regards

Andreas

Am 27.01.2021 um 12:46 schrieb Michael Van Canneyt:
>
>
> On Wed, 27 Jan 2021, Andreas Frieß via lazarus wrote:
>
>> On my Raspi/Debian 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
>>
>> try
>>       if IsOk then AConnection.Connected := true;
>>  except
>>       on E : Exception do begin
>>         IsOk:=false;
>>         raise;
>>       end;
>>  end;
>>
>> The calling function does this
>> Quote
>>   Result := false;
>>   try
>>     xxxxxxxx(IsOk);
>>     Result := true;
>>   except
>>     on E : Exception do begin
>>      .........
>
> Do you also re-raise here ?
>
>>
>>     end;
>>   end;
>>
>> So the exception should silent catched and i can handle if a connection
>> is ok or not.
>>
>> How can i avoid the unwanted box ?
>
> Normally catching the exception is enough.
>
> Michael.


More information about the lazarus mailing list