如何检测是否和的SQL Server或MSDE版本安装

 

;
; ISX 3.0.2
;
[Setup]
AppName=SQL_MSDEVersion
AppVerName=SQL_MSDEVersion
DefaultDirName={pf}\SQL_MSDEVersion
DisableStartupPrompt=true
Uninstallable=false
OutputBaseFilename=SQL_MSDEVersion
DisableDirPage=true
AdminPrivilegesRequired=true
[Code]
function GetSQLMSDEVersion(): String;
var
  sVersion:  String;
begin
  sVersion := '';
  // it is necessary to be an Admin to read this registry key
  if IsAdminLoggedOn then
   RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion', 'CurrentVersion', sVersion );
  Result := sVersion;
end;

function InitializeSetup(): Boolean;
var sqlver: String;
begin
  sqlver := GetSQLMSDEVersion();
  if Length( sqlver ) > 0 then
  begin
   MsgBox( 'Version ('+ sqlver +') of SQL Server/MSDE is installed.',
     mbInformation, MB_OK );
 // go on with setup
 Result := true;
  end
  else begin
   MsgBox( 'SQL Server/MSDE is not installed.', mbInformation, MB_OK );
   // cannot go with setup anyway
   Result := false;
  end;
end;

你可能感兴趣的:(数据库,职场,休闲,如何检测是否和的SQL,Server或MSDE版本安装)