1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| unit Connexion;
interface
uses
Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, DBXpress,
Controls, IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl,
IWCompLabel, DB, SqlExpr;
type
TfTestConnexion = class(TIWAppForm)
SQLConnection1: TSQLConnection;
lblConnexion: TIWLabel;
IWLabel1: TIWLabel;
procedure IWAppFormCreate(Sender: TObject);
public
end;
implementation
{$R *.dfm}
procedure TfTestConnexion.IWAppFormCreate(Sender: TObject);
begin
SQLConnection1.Connected;
if SQLConnection1.ConnectionState = csStateClosed then
begin
lblConnexion.Caption := 'KO';
lblConnexion.Font.Color := clWebFIREBRICK;
end
else
begin
lblConnexion.Caption := 'OK';
lblConnexion.Font.Color := clWebLIME;
end;
end;
initialization
TfTestConnexion.SetAsMainForm;
end. |
Partager