求C# C/S下查询当前环境是否装有framework2.0和MSSQL的完整代码(批处理文件最好),最好带注释的。
满意答案有追加
   一朋友做管理软件,问我要此代码。但是小弟水平不行,求牛人帮帮忙啦!他的开发环境 VS2005 MSSQL2000

解决方案 »

  1.   

    /********************************framework2.0检查**************************************/using System.Diagnostics;
    using System.IO;if (File.Exists(System.Environment.SystemDirectory + "\\MSCorEE.dll"))
            {
                FileVersionInfo myFileVersionInfo1 = FileVersionInfo.GetVersionInfo(System.Environment.SystemDirectory + "\\MSCorEE.dll");
                Label1.Text = "版本号:   " + myFileVersionInfo1.FileVersion;
            }/********************************MSSQL检查***************************************/
    using System.ServiceProcess; ServiceController []   service=ServiceController.GetServices();   
              for(int   i=0;i<service.Length;i++)   
              {   
                  if   (service[i].DisplayName.ToString()=="MSSQLSERVER")   
                  {   
                     Response.Write("True");
                  }
              } //必须在菜单项中引用:System.ServiceProcess.dll
      

  2.   

    1.没装framwork的话根本不可以运行c#程序
    2.判断没装的话可以捕捉错误码进行判断
      

  3.   

    楼上的说得没错,没有framwork怎么运行C# 程序
      

  4.   

    vs2003 需要的是framework1.0(1.1?) 这个是xp之类自己就集成的无需安装。
    完毕
      

  5.   

    可以做安装程序时把.netframework 作为安装程序的依赖做到安装程序里。。