InstallShield advanced application-check whether oracle or SQL Server is installed

Source: Internet
Author: User
Tags microsoft sql server 2005

 

 

 

Implementation principle: to determine whether a registry exists is determined by finding whether the registry contains the corresponding identifier.

Note: Windows XP and Windows 7 registry are stored in different ways, 32-bit and 64-bit operating system registry are stored in different ways, you need to determine separately. Only 32-bit operating systems are judged here.

 

Source code:

//// Check whether oracle is installed
Function number checkoracleisexist ()
String svoraclepath, nvvalue;
Number nkeytype, nvtype, nvsize;
Begin
// Defaut Regedit Root
Regdbsetdefaultroot (HKEY_LOCAL_MACHINE );
// Oralce Regedit path
If (regdbgetkeyvalueex ("Software \ oracle \ all_homes", "default_home", nvtype, nvvalue, nvsize) = 0) then
Return 0;
Endif;
Return-1;
End;

// SQL Server 2000, SQL Server 2005, SQL Server 2008,
// SQL Server 2005 Express, SQL Server 2008 Express
// Check whether SQL Server is installed
Function number checksqlserver ()
String nvvalue;
Number nvtype, nvsize;
Begin
// Return-1;
// Defaut Regedit Root
Regdbsetdefaultroot (HKEY_LOCAL_MACHINE );
// SQL Server 2000
If (regdbgetkeyvalueex ("Software \ Microsoft SQL Server", "installedinstances", nvtype, nvvalue, nvsize) = 0) then
Return 0;
Endif;
// The SQL Server 2005 version
If (regdbgetkeyvalueex ("Software \ Microsoft SQL Server 2005 redist \ Bol \ 2052 \ CurrentVersion", "version", nvtype, nvvalue, nvsize) = 0) then
Return 0;
Endif;
// SQL Server 2008 Express
// If (regdbgetkeyvalueex ("SOFTWARE \ Microsoft SQL Server 2008 redist \ sqlncli10 \ 2052 \ CurrentVersion", "version", nvtype, nvvalue, nvsize) = 0) then
// Return 0;
// Endif;
// Express
If (regdbgetkeyvalueex ("Software \ Microsoft SQL Server \ sqlexpress \ setup", "sqlpath", nvtype, nvvalue, nvsize) = 0) then
Return 0;
Endif;
Return-1;
End;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.