C#中如何判断sql服务器是否开启

2025-04-15 10:18:26
推荐回答(1个)
回答1:

code?

12345678910111213141516
//添加windows服务所需引用空间System.Service.Process.dllusing System.ServiceProcess; public static bool ExistSqlServerService() { bool ExistFlag=false; ServiceController[] service=ServiceController.GetServices(); for(int i=0;i