CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 1999
    Location
    Montreal, Quebec, Canada
    Posts
    192

    How to detect a broken connection?

    I have one question simple.

    I have a service which checks a database for new entries and scan at 30 secs intervals. If I reboot the SQL Server, this service crashes, even if I have error handling.

    My question is, is there a way to detect when the connection is OPENED that the server is not accessible and make it wait? I tought this was the connection timeout thing, but it doesn't seem it works when the connection is already established.

    Thank you!


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: How to detect a broken connection?

    We can find if we have opened Db by the state of the connection object

    adStateOpen
    adStateClosed
    adStateConnecting

    for example:
    If cnConnection.State = adStateOpen then
    cnConnection.Close
    else
    msgbox "Connection is lost"
    End If
    set cnConnection = nothing







    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Jul 1999
    Location
    Montreal, Quebec, Canada
    Posts
    192

    Re: How to detect a broken connection?

    Of course this was my first idea.. but the connection state is still Opened..


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured