如何在c#中停止并加载星号sql服务 [英] how can stop and star sql service in c#
问题描述
你好我的朋友..我有一个问题我的问题是启动sql server服务时ı运行程序ı停止服务但是当我开始服务时可能会出错。我的服务名称是MSSQL $ SQLEXPRESS
ServiceController sc = new ServiceController(MSSQL $ SQLEXPRESS);
sc.Stop();
sc.Refresh();
sc.Start();
当程序进入sc时.Start()程序将关闭并出现错误
错误是;无法在计算机上启动服务MSSQL $ SQLEXPRESS。
Hello my friend..I have a question my problem is start service of sql server when ı run the program ı stoped the service but ı can get an error when ı trıed to start services..My service name is MSSQL$SQLEXPRESS
ServiceController sc = new ServiceController("MSSQL$SQLEXPRESS");
sc.Stop();
sc.Refresh();
sc.Start();
when the program comming to sc.Start() program will be down and get an error
error is;Cannot start service MSSQL$SQLEXPRESS on computer.
推荐答案
SQLEXPRESS
ServiceController sc = new ServiceController(MSSQL
SQLEXPRESS
ServiceController sc = new ServiceController("MSSQL
SQLEXPRESS);
sc.Stop();
sc.Refresh();
sc.Start();
当程序进入sc时.Start()程序将关闭并出现错误
错误是;无法在计算机上启动服务MSSQL
SQLEXPRESS");
sc.Stop();
sc.Refresh();
sc.Start();
when the program comming to sc.Start() program will be down and get an error
error is;Cannot start service MSSQL
SQLEXPRESS。
SQLEXPRESS on computer.
这篇关于如何在c#中停止并加载星号sql服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!