ADO Connection Check

From: Tim Horn (tim_at_umbani.com)
Date: 10/18/04


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



Relevant Pages

  • Re: Accessing an SQL Server database file
    ... Do you mind explaining to me how the connection string written their works? ... All systems have SQL Server Express and SQL Server 2005 installed. ... owningObject, SqlConnectionString connectionOptions, String newPassword, ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: ASP.NET 2.0 deployment (w/ SQL Srvr 2005) error
    ... The connection string was ok. ... than the SQL Server Instance, ... owningObject, SqlConnectionString connectionOptions, String ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Custom membership provider problem
    ... SQL server 2005 does not install with the TCP/IP protocol turned on. ... >An error has occurred while establishing a connection to the server. ... 25 - Connection string is not valid) ... >Boolean& failoverDemandDone, String host, String failoverPartner, String ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: ASP .Net connection to Sql Server
    ... Using "dbmssocn" tells it to use the TCP/IP network driver, ... It is connecting via a connection string similiar to: ... > string to our production SQL server and everything runs fine. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Performance of ODBC
    ... Usiing Access front-end to connection a back end through ... the Internet connection is definitely slow with currently affordable network ... Unless you can get a network connection that fast enough and ... that Access is the front end, and the SQL server is the back end. ...
    (microsoft.public.access.adp.sqlserver)