Advanced Installer: Run sql query script just before finishing query

375 views Asked by At

I just want to run a SQL query just before finishing of installation (after all installation stuff).

How should I config schedule of SqlQueryAction?

My scenario is like this, when installation starts I run a query to set InstallationProgress flag in my database to 1. Then after installation finish or installtion failure i should set InstallationProgress flag to 0.

I'm using Advanced Installer 17.0 and here is my installation configuration.

My Installer is installing a web service on IIS and when it is installing web service and configuration of IIS is in progress SqlQueryAction_Set0 is executed while I want to be executed after all installation stuff is finished (not during its progress). Here is my current scheduling: enter image description here

1

There are 1 answers

0
EuSebyU On

For the "SqlQueryAction_Set0" custom action to be executed at the end of the installation, the "When the system is being modified (deferred)" option should be set for it.

Also, if you want to set that flag to 0 in case of an installation failure, you need to add another custom action after the "Preparing" action group and set the "During installation rollback" option for it.

However, for the rollback custom action to completely fulfill its purpose, it is recommended to also add the "SqlQueryAction_Set1" custom action as a deferred custom action after the "Preparing" action. You can read more information in the "Windows Installer Custom Actions" article.