Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Stop MSSQLServer before uninstalling


5 replies to this topic

snow

snow
  • Members
  • 3 posts

Posted 10 December 2002 - 10:40

I need to stop MSSQLServer before uninstalling MSDE 2000 merge module. Which is the best way to do this?

I tried calling LaunchAppEx:
szProgram = "C:\\Programmi\\Microsoft SQL Server\\80\\Tools\\Binn\\scm.exe";
szCommand = " -Action 6 -Service MSSQLSERVER";
LongPathToQuote(szProgram,TRUE);
LongPathToQuote(szCommand,TRUE);
_LaunchAppEx(szProgram,szCommand,WAIT,SW_SHOWNORMAL,-1,nvExitCode);


with these instructions I obtain that scm executes as if without command line parameters, it shows that window with instructions on using it...

I don't know if this is a right way to solve my problem.

Could someone help me, please?

cmcintosh

cmcintosh
  • Members
  • 7 posts

Posted 11 December 2002 - 18:35

LaunchAppAndWait("net", "stop MSSQLServer /y",WAIT);
You can try this code.  The /y is to address any confirmations that might be asked during the shutting down of the server.  The downfall to this method is that a DOS window will appear but it closes itsself.  There are ways of hidding the process but they include creating a c++ dll and using the creatprocess function which allows you to hide windows. Becarful to take into consideration that a user may have more than one instance of SQLServer installed and to shut down the appropriate one best way to get that info is to ask the user. ;)

snow

snow
  • Members
  • 3 posts

Posted 12 December 2002 - 08:11

cmcintosh,

snow

snow
  • Members
  • 3 posts

Posted 12 December 2002 - 08:16

cmcintosh,
 thank you for answering. The solution you suggested me, works fine with Win2K but not in Win98.
I testsed it from the command line, but I get this error:
"Error 2185: Service name is not valid."
Any ideas?
Thanks :0

bluegoose

bluegoose
  • Members
  • 2 posts

Posted 23 January 2003 - 12:42

Try adding the Silent option.

szCommand = " -Action 6 -Silent 1 -Service MSSQLSERVER";

It should fix it.

bluegoose

bluegoose
  • Members
  • 2 posts

Posted 23 January 2003 - 12:47

You may need to stick a space in at the start.

" -Action...

I use the scm command and it work smoothly on win98.