Roman B.
Posts: 5
Joined: Thu Apr 05, 2012 8:31 am

SQL script not running during Repair

Hi.

I have a SQL script scheduled to run at install and during maintenance.
In addition, the script has a condition of &MyFeatureName = 3 ("MyFeatureName" is replaced with the appropriate name). This is used because the script is related to a specific feature.

For some reason, the script is not running during repair. If I remove the above "feature installed" condition, the script does run during repair.

What am I doing wrong?

While I'm at SQL related issues, I would like to clarify another thing:
When using a predefined connection, do I need to store all the relevant values in the registry (and use a search during install, uninstall and repair) to keep all the relevant values that are used in the predefined connection or does the predefined connection takes care of this for me?

Thanks in advance.
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: SQL script not running during Repair

Hello,
I have a SQL script scheduled to run at install and during maintenance.
In addition, the script has a condition of &MyFeatureName = 3 ("MyFeatureName" is replaced with the appropriate name). This is used because the script is related to a specific feature.

On repair mode if a component key file is missing, then the related component will be reinstalled. Also, a feature will be reinstalled during repair only if at least one of its components will be reinstalled.

Please keep in mind that (&MyFeatureName = 3) condition is true only if the related feature will be installed locally. So, on repair mode if the corresponding feature will not be reinstalled the related condition will be false.

If you want to test if the related feature is already installed on the machine, then you should use the following condition:
(!MyFeatureName = 3)

If you want your SQL script to run only if a specific feature (i.e. MyFeatureName) will be installed or is already installed, then you should use the following condition:
((&MyFeatureName = 3) OR (!MyFeatureName = 3))

Also, if you want your SQL script to run only on repair, and only if a specific feature (i.e. MyFeatureName) will be installed or is already installed, then you should use the following condition:
(((&MyFeatureName = 3) OR (!MyFeatureName = 3)) AND REINSTALL )

Please take a look on our "Edit Condition" article.
When using a predefined connection, do I need to store all the relevant values in the registry (and use a search during install, uninstall and repair) to keep all the relevant values that are used in the predefined connection or does the predefined connection takes care of this for me?

If you want the properties to keep their values during maintenance or uninstall, then you should write the properties values into the registries and then read the properties values from registries. Please take a look on our "Make the properties keep their values during Maintenance" article.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
navya
Posts: 55
Joined: Thu Jan 05, 2012 6:36 am

Re: SQL script not running during Repair

HI Team ,
I am unable to run the SQL Script during Uninstall. I tried Adding values in registry and adding in search.
But still I am not able to run the Script file during uninstall.Please check the above attached api
Attachments
Navya.aip
(24 KiB) Downloaded 607 times
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: SQL script not running during Repair

Hi,

I have looked on your project and I have noticed some errors.

First, when you search for the username, you search it in the wrong location "HKEY_CURRENT_USER" instead of "HKEY_LOCAL_MACHINE".

Then if you want your searches to be attached to their corresponding properties (the search for username to USERNAME_PROP etc.) you have two ways:

1. Set the search name with the name of the property you want to attach it to (the search for password rename it "PASSWORD_PROP" etc)

OR

2. Create a custom action for every search and attach the search to its corresponding property. It can be done with the "Set installer property" custom action.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”