Solved

Check Online Access w/VB6 App

Posted on 2014-02-27
3
296 Views
Last Modified: 2014-03-02
I use the following to connect to our server with my vb6 application.  If we have no internet connection it throws an error.  I would like to "test" the connectivity and notify that we have no online access rather than just throw an error:

    Set srvr_conn = New ADODB.Connection
    srvr_conn.Open "Provider=SQLNCLI10;Server=216.185.199.1,1433\SQLExpress;Database=db;Uid=uid;Pwd=pwd;"

Open in new window


Thanks!
0
Comment
Question by:Bob Schneider
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
Valliappan AN earned 250 total points
ID: 39891594
Look at this:

http://support.microsoft.com/kb/168336

on handle errors for ADO.

Also this:

http://support.microsoft.com/kb/167957/EN

(to handle all errors vb and ADO combined)
0
 
LVL 4

Assisted Solution

by:ravikantninave
ravikantninave earned 250 total points
ID: 39892387
Generally I use this Method.
First I check if Internet is connected If yes then goto connection else show error
Function GetHTMLCode(strURL) As String
On Error Resume Next
    Dim strReturn                   ' As String
    Dim objHTTP                     ' As MSXML.XMLHTTPRequest
    If Len(strURL) = 0 Then Exit Function
    Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
    objHTTP.Open "GET", strURL, False
    objHTTP.Send                    'Get it.
    strReturn = objHTTP.ResponseText
    Set objHTTP = Nothing
    GetHTMLCode = strReturn
End Function

Open in new window


    Dim strIntConnn As String
    strIntConnn = GetHTMLCode("http://www.google.com")
    If Len(strIntConnn) > 0 Then
      ConnectToDb
else
     MsgBox "Sorry!!!" & vbCrLf & "No Internet Connection Found.  Please Connect Internet First.", vbInformation + vbOKOnly, "System Information :"
endif

Open in new window

0
 

Author Closing Comment

by:Bob Schneider
ID: 39899085
Thank you!
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question