Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
N

navyjax2

@navyjax2
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • [Message Deleted]
    N navyjax2

    You can't do it that way, with Process.Start(" ~ DOS NET START/STOP ~ "); You have to do it like this (assuming SQL Server is running on the same computer as your program): string localComputer = Environment.MachineName.ToString(); // Stop MSSQLSERVER ServiceController controller = new ServiceController(); controller.MachineName = localComputer; controller.ServiceName = "MSSQLSERVER"; string status = controller.Status.ToString(); if (status == "Running") { // Stop the service controller.Stop(); Console.WriteLine("MSSQLSERVER has been stopped."); } // Start MSSQLSERVER controller.MachineName = localComputer; controller.ServiceName = "MSSQLSERVER"; status = controller.Status.ToString(); if (status == "Stopped") { // Stop the service controller.Start(); Console.WriteLine("MSSQLSERVER has been started."); } Also, make sure the service name is MSSQLSERVER in the Services console (Start -> Run -> services.msc). On named instances, this is not always the case. -Tom

    C#
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups