Click here to Skip to main content
15,900,254 members
Home / Discussions / C#
   

C#

 
GeneralRe: How did you learn to program? Pin
Colin Angus Mackay13-Dec-06 21:35
Colin Angus Mackay13-Dec-06 21:35 
GeneralRe: How did you learn to program? Pin
Hamid_RT13-Dec-06 22:20
Hamid_RT13-Dec-06 22:20 
AnswerRe: How did you learn to program? Pin
SpartanSoft14-Dec-06 9:03
SpartanSoft14-Dec-06 9:03 
QuestionObject Factories with Lazy Loading in C# Pin
cebyrjoe213-Dec-06 10:46
cebyrjoe213-Dec-06 10:46 
AnswerRe: Object Factories with Lazy Loading in C# Pin
Colin Angus Mackay13-Dec-06 11:22
Colin Angus Mackay13-Dec-06 11:22 
Question[Message Deleted] Pin
R_L_H13-Dec-06 9:49
R_L_H13-Dec-06 9:49 
AnswerRe: How do you programmatically restart a Service? (specifically SQL Server) Pin
Colin Angus Mackay13-Dec-06 11:29
Colin Angus Mackay13-Dec-06 11:29 
GeneralRe: How do you programmatically restart a Service? (specifically SQL Server) Pin
navyjax224-Dec-08 13:14
navyjax224-Dec-08 13:14 
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
AnswerRe: How do you programmatically restart a Service? (specifically SQL Server) Pin
Andy Brummer13-Dec-06 11:37
sitebuilderAndy Brummer13-Dec-06 11:37 
QuestionResize row height in DataGrid (Pocket PC)? Pin
george ivanov13-Dec-06 7:17
george ivanov13-Dec-06 7:17 
Questionwin form datagridview sort by column Pin
fmardani13-Dec-06 6:07
fmardani13-Dec-06 6:07 
AnswerRe: win form datagridview sort by column Pin
Milky Way13-Dec-06 10:17
Milky Way13-Dec-06 10:17 
QuestionUnable to Deserialize - [cannot find an Assembly ] Pin
Eytukan13-Dec-06 5:48
Eytukan13-Dec-06 5:48 
AnswerRe: Unable to Deserialize - [cannot find an Assembly ] Pin
Karthik Kalyanasundaram13-Dec-06 6:03
Karthik Kalyanasundaram13-Dec-06 6:03 
GeneralRe: Unable to Deserialize - [cannot find an Assembly ] Pin
Eytukan13-Dec-06 18:05
Eytukan13-Dec-06 18:05 
QuestionDataTable.AcceptChanges Pin
wasife13-Dec-06 5:19
wasife13-Dec-06 5:19 
AnswerRe: DataTable.AcceptChanges Pin
Andrew Rissing13-Dec-06 7:23
Andrew Rissing13-Dec-06 7:23 
QuestionWriting to an access database with credentials Pin
Beaumont113-Dec-06 4:28
Beaumont113-Dec-06 4:28 
AnswerRe: Writing to an access database with credentials Pin
led mike13-Dec-06 6:39
led mike13-Dec-06 6:39 
GeneralRe: Writing to an access database with credentials Pin
Beaumont113-Dec-06 7:11
Beaumont113-Dec-06 7:11 
GeneralRe: Writing to an access database with credentials Pin
led mike13-Dec-06 7:22
led mike13-Dec-06 7:22 
GeneralRe: Writing to an access database with credentials Pin
Beaumont113-Dec-06 7:24
Beaumont113-Dec-06 7:24 
Questionhow to read from a ethernet connection Pin
faladrim13-Dec-06 3:43
faladrim13-Dec-06 3:43 
QuestionClass inheritance and interfaces Pin
Dario Solera13-Dec-06 3:39
Dario Solera13-Dec-06 3:39 
AnswerRe: Class inheritance and interfaces Pin
J4amieC13-Dec-06 3:45
J4amieC13-Dec-06 3:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.