本文整理自网络,侵删。
实例如下:
//首先要添加 System.ServiceProcess.dll 引用 ServiceController sc = new ServiceController("MSSQLSERVER"); //判断服务是否已经关闭 if (sc.Status == ServiceControllerStatus.Stopped) { sc.Start(); MessageBox.Show("SQL数据库服务启动成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } //判断服务是否已经开启 if (sc.Status != ServiceControllerStatus.Stopped) { sc.Stop(); MessageBox.Show("SQL数据库服务成功关闭!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); }
以上这篇C# 启动 SQL Server 服务的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
标签:SQLite
相关阅读 >>
开源 5 款超好用的数据库 gui 带你玩转 mongodb、redis、sql 数据库(推荐)
Sqlite developer怎么安装激活 Sqlite developer激活安装图文教程
navicat for Sqlite导入csv中文数据的方法
更多相关阅读请进入《Sqlite》频道 >>
数据库系统概念 第6版
本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。