ADO Connection Check
From: Tim Horn (tim_at_umbani.com)
Date: 10/18/04
- Next message: Thad Smith: "SQL Server 2005 Problems"
- Previous message: Bob Dalton: "Re: Client vs Server Cursor - Pros/Cons?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 18 Oct 2004 21:12:39 +0200
The following is the Code i use to connect to a SQL Server database where i
have included the string in a SQL.txt file.
procedure TfrmMapsys.FormShow(Sender: TObject);
Var
Unq:Integer;
M1:String;
F1:TextFile;
Ch:String[100];
j:Integer;
begin
AssignFile(F1,'SQL.Txt');
Reset(F1);
try
while not eof(F1) do
Begin
Readln(F1,Ch);
ADOConnection1.ConnectionString:=ADOConnection1.ConnectionString+Ch;
end;
finally
CloseFile(F1);
end;
ShortDateFormat:='dd/MM/yyyy';
ADOConnection1.Connected:=True;
end;
The SQL server is running on a remote server and the Delphi 6 application is
running on a local PC. The problem i have is when the network connection is
broken or doesn't exist and i need to constantly monitor the Server
connection.
If i unplug the network cable then i get a invalid connection string error.
How do i capture/test for this condition ? Any code example would be
apprieciated.
Thanks
Tim
- Next message: Thad Smith: "SQL Server 2005 Problems"
- Previous message: Bob Dalton: "Re: Client vs Server Cursor - Pros/Cons?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|