Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Check Online Access w/VB6 App

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…
Suggested Courses

636 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