写程序自动为msde打sp3包

王朝网络·other·作者佚名  2006-01-09
宽屏版  字体: |||超大  

如下程序解决了用户自己升级msde的sp3时要配置参数,输入SQL密码等一系列问题,既保证了SQL密码的安全性,又简便了用户的升级操作(只要把程序编译好放在SP3的目录里双击就可以了)

// update3.cpp : Defines the entry point for the application.

//

#include "stdafx.h"

#include <process.h>

int APIENTRY WinMain(HINSTANCE hInstance,

HINSTANCE hPrevInstance,

LPSTR lpCmdLine,

int nCmdShow)

{

// TODO: Place code here.

HANDLE consoleStdout,consoleStdin;

::AllocConsole();

consoleStdin=::GetStdHandle(STD_INPUT_HANDLE);

consoleStdout=::GetStdHandle(STD_OUTPUT_HANDLE);

if(consoleStdin==consoleStdout)

return 1;

char consoleName[256];

::GetConsoleTitle(consoleName,256);

HWND hwnd=::FindWindow("ConsoleWindowClass",consoleName);

if(hwnd)

{

::SendMessage(hwnd,WM_SYSCOMMAND,(WPARAM)SC_MINIMIZE,0);

::ShowWindow(hwnd,SW_HIDE);

}

system("net stop MSSQL$ERP");

system("setup /upgradesp sqlrun INSTANCENAME=实例名 SECURITYMODE=SQL UPGRADEUSER=sa UPGRADEPWD=密码 DISABLENETWORKPROTOCOLS=1");

system("net start MSSQL$ERP");

::MessageBox(NULL,"所有操作已结束","msde升级sp3",MB_OK);

return 0;

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有