Question Check Network Connection

rickjackson

New member
Joined
Sep 24, 2010
Messages
4
Programming Experience
1-3
Hey,

I am using SqlHelper Class for accessing Database and my Database is different server which can be accessed through the LAN. Now the issue i am facing if i removed the Network Cable then my application Crashes cause he dosent find the server to access the database so how can i show the message to the user " Not Able to Access the server " when the connection is not getting established:

Urgent Help Needed Thanks

Thanks
 
VB.NET:
Expand Collapse Copy
        If System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() Then
            'You have a connection
        End If

If you need to monitor a change in network availability or IP Address you can use System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged or
System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged events.
 
Back
Top