Skip to content

Instantly share code, notes, and snippets.

@fredgdaley2
Last active August 24, 2017 14:12
Show Gist options
  • Save fredgdaley2/33eef1a8f2caaa394f4154a24f7c3f78 to your computer and use it in GitHub Desktop.
Save fredgdaley2/33eef1a8f2caaa394f4154a24f7c3f78 to your computer and use it in GitHub Desktop.
Check if an MSSQL server is alive
Imports System.Data.SqlClient
Public Function IsMsSqlServerAvailable(ByVal dbCnxStr As String) As Boolean
Try
Using srvrConnection = New SqlConnection(dbCnxStr)
Try
srvrConnection.Open()
Return True
Catch ex As SqlException
Return False
End Try
End Using
Catch ex as ArgumentException
Return False;
End Try
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment