?
Solved

Check Online Access w/VB6 App

Posted on 2014-02-27
3
Medium Priority
?
300 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 1000 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 1000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

771 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