Public Sub CheckForSQL(ByVal Server As String) Try Dim controller As New System.ServiceProcess.ServiceController("MSSQLSERVER") controller.MachineName = Server If controller.Status.Equals(System.ServiceProcess.ServiceControllerStatus.Running) AndAlso controller.CanStop Then 'All good continue on SQLExists = True Return ElseIf controller.Status.Equals(System.ServiceProcess.ServiceControllerStatus.Stopped) Then controller.Start() SQLExists = True Return Else MsgBox("SQL Controller Status: " & controller.Status) SQLExists = False Return End If Catch ex As Exception MsgBox(ex.Message) SQLExists = False Return End Try End Sub
really
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)