I have a custom action
<CustomAction Id="SqlCmdExeRESTORE" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="check" Execute="deferred" Impersonate="yes" />
<CustomAction Id="SqlCmdRESTORE" Property="SqlCmdExeRESTORE" Value=""[SQLBINDIR]sqlcmd.exe" -S .\MYDB -U sa -P MyPass -Q "RESTORE DATABASE MYDB FROM DISK = N'[MSSQLDIR]\Backup\MYDB.bak'"" />
How does show dialog where user write correct password if custom action has error and run it's again.
Thanks for ideas
It's not the right way to do it - custom actions should not show any UI, interacting with user. Imagine the behavior of such an action during quiet (unattended) installation, for instance.
You should ask the password from the user at the UI phase of your installation program. I mean, have a dialog with the SQL name/password pair of textboxes, and tie those textboxes to the MSI properties to store the entered value. Later on, pass the appropriate property values to the custom action:
<CustomAction Id="SqlCmdRESTORE" Property="SqlCmdExeRESTORE" Value=""[SQLBINDIR]sqlcmd.exe" -S .\MYDB -U [SQLUSER] -P [SQLPASS] -Q "RESTORE DATABASE MYDB FROM DISK = N'[MSSQLDIR]\Backup\MYDB.bak'"" />
This was a quick solution in scope of your question. However, it reveals some design issues I'd like to point out.
First of all, you should try to avoid EXE custom actions as much as possible. Here's one of the sources describing why. For instance, in your case the custom action could be re-factored into C# custom action using ADO.NET to address SQL server. Just an example.
Besides, the custom action which changes the target system, should always go in pair with the appropriate rollback action. In case of rollback, the system should be left in the state it was when the installation started.