用户想实现这个功能。用c#写的程序,卸载掉安装在机器上的SQL 2000或是05.这样能做到吗?

解决方案 »

  1.   

    通过注册表找到 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server 2000
    里面有个键/值 为 UninstallString : C:\WINDOWS\IsUn0804.exe -f"C:\Program Files\Microsoft SQL Server\MSSQL\Uninst.isu" -c"C:\Program Files\Microsoft SQL Server\MSSQL\sqlsun.dll" -msql.mif i=MSSQLSERVER直接开进程调用.呵呵.
      

  2.   

    这个是命令行卸载sql server 2005,可能你需要知道sql server的安装路径,并在C#中调用命令行。To remove a default, stand-alone installation of SQL Server 2005 from the command prompt 
    Insert the SQL Server 2005 installation media into the disk drive.Uninstall SQL Server, using the following syntax: Copy Code
    Start /wait <CD or DVD Drive>\setup.exe /qb REMOVE=SQL_Engine,Client_Components INSTANCENAME=<InstanceName>For the default instance, specify "MSSQLSERVER" for <InstanceName>. Using REMOVE=ALL to remove instance components also removes shared components: SQL Server Tools, Integration Services, and Notification Services.
      

  3.   

    可以调用Windows Installer的API,不过那只针对一个产品,而SQL Server包含多个产品
    最保险的办法还是用安装盘上的MSI删除