PDA

View Full Version : How do I check for the presence of SQL and run a conditional installation



johnberndt
07-16-2004, 11:21 AM
I am trying to install a project that includes MSDE IF SQLServer does not exist. How do I do this?

PilotBob
07-16-2004, 03:51 PM
Can you make the MSDE install conditional on whether you find SQL Server installed based on a registry or file search?

helmut
07-20-2004, 04:48 AM
Once I had the same problem and I solved it this way:

I defined a feature, which is not shown to the user. This feature holds the MSDE object.

In my setup script I decided, if the feature should be installed or not. Therefore I queried the registry database this way:


function BOOL IsSQLServerInstalled ()
string strKeyName, strValueName;
string strInstalledInstances;
number dataType, dataSize;
number rc;
begin
strKeyName = "Software\\Microsoft\\Microsoft SQL Server";
strValueName = "InstalledInstances";

RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);

rc = RegDBGetKeyValueEx (strKeyName, strValueName, dataType, strInstalledInstances, dataSize);

if (rc < 0) then
return FALSE;
endif;

return TRUE;
end;


Depending on the result of the function call I selected or unselected the hidden feature like this:

FeatureSelectItem (MEDIA, strFeatureName, boolInstall);

I hope this solves your problem.

johnberndt
07-20-2004, 11:45 AM
Originally posted by helmut
Once I had the same problem and I solved it this way:

I defined a feature, which is not shown to the user. This feature holds the MSDE object.

In my setup script I decided, if the feature should be installed or not. Therefore I queried the registry database this way:


function BOOL IsSQLServerInstalled ()
string strKeyName, strValueName;
string strInstalledInstances;
number dataType, dataSize;
number rc;
begin
strKeyName = "Software\\Microsoft\\Microsoft SQL Server";
strValueName = "InstalledInstances";

RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);

rc = RegDBGetKeyValueEx (strKeyName, strValueName, dataType, strInstalledInstances, dataSize);

if (rc < 0) then
return FALSE;
endif;

return TRUE;
end;


Depending on the result of the function call I selected or unselected the hidden feature like this:

FeatureSelectItem (MEDIA, strFeatureName, boolInstall);

I hope this solves your problem.

Thanks for your help.