程序启动Sql Server其实很简单
代码:
System.ServiceProcess.ServiceController myController =
new System.ServiceProcess.ServiceController("MSSQL$ACCP4444"); //服务名称 找了半天才找到,笨死我完了。在服务上右键属性,能看到
if (myController.CanStop)
{ }
else
{
myController.Start();
}
//注 需要引用 System.ServiceProcess 在项目->添加引用->能找到这个引用。