cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
milan10
Level 4

SQLServerSelectLogin2 database variable

Hello,

I am working with InstallScript project (2008 version of InstallShield), where I need to let user type in a variable database name. In this new version there is a new SQLServerSelectLogin2 functon with bShowDBcatalog as one of the parameters where user types in or selects available database by clicking on the Browse button.
I am running SQL script to restore a database which would create that database on the server. But when I type in a database name I get error that it is not available on the server.
Can anyone help?

Thanks,

Milan
Labels (1)
0 Kudos
(7) Replies
hidenori
Level 17

You need to run the script that will create the desired database during logging in by selecting the Run Script During Login option in the Script | Runtime tab. The database must present before InstallShield connects to it. The option allows you to run a script after the login credentials are verified, and before connecting to a specified database. Please refer to http://helpnet.installshield.com/Robo/BIN/Robo.dll?tpc=/robo/projects/installshield11helplib/SQL-Script_Runtime.htm for more details about the option.

Hope that helps.
0 Kudos
milan10
Level 4

No it did not help. Still when I type in the database name in the edit database field (catalog name), I can only type in a database that is available on the server. It would not let me create my own database.
0 Kudos
hidenori
Level 17

Would it be possible for you to email me your project and SQL scripts at hidenoriy@macrovision.com? I am wondering how you pass the specified catalog name to your script that restores a database.

Thank you.
0 Kudos
milan10
Level 4

I sent it!
0 Kudos
hidenori
Level 17

Thank you for providing your scripts. You do not seem to specify the catalog name entered in the SQLLogin dialog to use in your RESTORE DATABASE statement. Please follow the steps below to resolve the issue.

1. Add the following line immediate after the SQLServerSelectLogin2 call in the OnSQLServerInitialize() event:

TextSubSetValue("", szDB, TRUE);


2. Add the following text replacement entry to your SQL script in the SQL Scripts veiw:

Find What: FileHold4
Replace With:

3. Build your setup


You also need to replace such placeholders as FileHold1, FileHold2 etc. used in your SQL script with real values.
0 Kudos
milan10
Level 4

I already set the plaeholders and the FileHold1 and FileHold2 are real values...they are in the setup.rul:
// Setting SQL script variables
if (bEmpty) then
szBackup = SUPPORTDIR ^ "V5_EMPTY.BAK";
else
szBackup = SUPPORTDIR ^ "V5_DEMO.BAK";
endif;
szMDF = svDir ^ svDB + ".MDF";
szLDF = svDir ^ svDB + ".LDF";
TextSubSetValue( "", szBackup, TRUE );
TextSubSetValue( "", szMDF, TRUE );
TextSubSetValue( "", szLDF, TRUE );
TextSubSetValue( "", svDB, TRUE);
0 Kudos
hidenori
Level 17

I am sorry that I missed it. It seems too late that you set the information to the text substitutes. That must be done between the SQLServerSelectLogin2() and SQLRTConnect() function calls in the OnSQLServerInitialize() event. Also, I would suggest you to debug into your InstallScript code and see if the catalog name is set to the svDB global variable as expected.
0 Kudos