Hi all, I have the following code that I use to connect to a Firebird database, which works fine, however, if the Firebird server becomes unavailable, fIBConnection.Connected always returns true. What's the best way of checking to make sure that the Firebird server is still available before I attempt to connect to the database?
Thanks in advance Richard fOnline := True; try if fIBConnection.Connected then Exit; with fIBConnection do begin HostName := 'hostname'; DatabaseName := 'location'; UserName := 'username'; Password := 'password'; end; end; fIBConnection.Transaction := fSQLTransaction; with fSQLQuery do begin DataBase := fIBConnection; Transaction := fSQLTransaction; end; //Finally switch on connection fSQLTransaction.DataBase := fIBConnection; fIBConnection.Connected := True; except fOnline := False; end;
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus