显示错误!无法在计算机上打开MSSQLSSQLEXPRESS服务'。'。请帮忙 [英] Show error! Cannot open MSSQLSSQLEXPRESS service on computer'.'. Please help
问题描述
无法在计算机上打开MSSQLSSQLEXPRESS服务'。'。
我尝试过:
Dim myController As New System.ServiceProcess.ServiceController(SQL Server(SQLEXPRESS))
------------------------------------- --------------------------------------------
私有 Sub Service_status()
如果 myController.Status = ServiceProcess.ServiceControllerStatus.Running 那么
TextBox1.Text = 已开始
ElseIf myController。 Status = ServiceProcess.ServiceControllerStatus.Stopped 然后
TextBox1.Text = 已停止
结束 如果
结束 Sub
-------- -------------------------------------------------- ------------------------
私人 Sub Button2_Click( ByVal sender As 系统。对象, ByVal e As System.EventArgs)句柄 Button2.Click
Service_status()
结束 Sub
-------------------- -------------------------------------------------- -------------
私人 Sub BtnStop_Click( ByVal sender As System。 Object , ByVal e As System.EventArgs)< span class =code-keyword>句柄 BtnStop.Click
ProgressBar1.Value = 0
尝试
myController。停止()
Catch ex As 异常
MsgBox(ex.Message)
最后
ProgressBar1.Value = 100
myController.WaitForStatus(ServiceProcess.ServiceControllerStatus.Stopped)' < span class =code-comment> //添加
Service_status()
结束 尝试
结束 < span class =code-keyword> Sub
--------------------- -------------------------------------------------- ----------------
私人 Sub BtnStart_Click( ByVal sender As System。对象, ByVal e As System.EventArgs)句柄 BtnStart.Click
ProgressBar1.Value = 0
尝试
myController.Start()
Catch ex As Exception
MsgBox(ex.Message)
最后
ProgressBar1.Value = 100
myController.WaitForStatus(ServiceProcess.ServiceControllerStatus.Running) ' //添加
Service_status()
结束 尝试
结束 Sub
这可能是因为服务名称实际上是MSSQL
< blockquote> SQLEXPRESS,而不是SQL Server(SQLEXPRESS)。您使用的是显示名称,而不是服务名称。
Cannot open MSSQLSSQLEXPRESS service on computer'.'.
What I have tried:
Dim myController As New System.ServiceProcess.ServiceController("SQL Server (SQLEXPRESS)")
---------------------------------------------------------------------------------
Private Sub Service_status()
If myController.Status = ServiceProcess.ServiceControllerStatus.Running Then
TextBox1.Text = "Started"
ElseIf myController.Status = ServiceProcess.ServiceControllerStatus.Stopped Then
TextBox1.Text = "Stopped"
End If
End Sub
----------------------------------------------------------------------------------
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Service_status()
End Sub
-----------------------------------------------------------------------------------
Private Sub BtnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnStop.Click
ProgressBar1.Value = 0
Try
myController.Stop()
Catch ex As Exception
MsgBox(ex.Message)
Finally
ProgressBar1.Value = 100
myController.WaitForStatus(ServiceProcess.ServiceControllerStatus.Stopped) '//Add
Service_status()
End Try
End Sub
---------------------------------------------------------------------------------------
Private Sub BtnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnStart.Click
ProgressBar1.Value = 0
Try
myController.Start()
Catch ex As Exception
MsgBox(ex.Message)
Finally
ProgressBar1.Value = 100
myController.WaitForStatus(ServiceProcess.ServiceControllerStatus.Running) '//Add
Service_status()
End Try
End Sub
That's probably because the service name is actually "MSSQL
SQLEXPRESS", and not "SQL Server (SQLEXPRESS)". What you used is the Display Name, not the Service name.
这篇关于显示错误!无法在计算机上打开MSSQLSSQLEXPRESS服务'。'。请帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!