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

SQLServerSelectLoginDlg

This new login dialog has an edit database catalog box which allows users to specify database catalogs. Does this work only for the available catalogs on a server, which can be selected by clicking on the browse button, or user can type in his own (variable) catalog name?
Anybody knows how to do this?
Labels (1)
0 Kudos
(10) Replies
hidenori
Level 17

You need to select the "Create Catalog if Absent" option in order for end users to be able to specify a database name that does not exist on the target server. The option will create the specified database after the login credential is verified and before connecting to the database.

Hope that helps.
0 Kudos
milan10
Level 4

I check the Create Catalog If Absent and then I enter password and database name. The database name is recorded and when I click on the Browse button it is there. But then when the SQL script is run to restore that database I get syntax errors.
0 Kudos
hidenori
Level 17

If you have your own SQL script to create a database, you need to uncheck the "Create Catalog If Absent" option. Also, you need to run that script during logging in by selecting the "Run Script During Login" option in the Script | Runtime tab. In addition, the following steps illustrate how you pass the catalog name entered in the SQLServerSelectLoginDlg dialog to your SQL script:

1. Use a placeholder for the RESTORE DATABASE statement in your SQL script.

RESTORE DATABASE %MyDB%

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

TextSubSetValue("", szDB, TRUE);

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

Find What: %MyDB%
Replace With:

4. Build your setup


The database must exist before InstallShield attempts to establish a connection to it. The "Run Script During Login" option allows you to run a script after the login credential is verified, and before connecting to a specified database.

Regards.
0 Kudos
milan10
Level 4

No, it does not work. Maybe because I converted the project from InstallShield 11 to InstallShield 2008. And now some functionality is lost. I tried to import the SQLServerSelectLoginDlg from version 11 (where I have added edit box for database name so users can type in whatever they want). This worked perfectly in v. 11. But now when I converted it to v. 2008 I get SQL errrors when executing the scripts.
0 Kudos
hidenori
Level 17

What does the SQL scripting error say? Does it work if you create a new InstallScript project in IS 2008?
0 Kudos
milan10
Level 4

I will try to create a new project in IS 2008.
0 Kudos
milan10
Level 4

I created a new IS 2008 project and I get SQL errors: error on line 6 in this script:

RESTORE DATABASE FileHold4
FROM DISK = 'FileHold1'
WITH REPLACE,
MOVE 'DBs' TO 'FileHold2',
MOVE 'Dbs_Log' TO 'FileHold3'
GO

This works in IS 11. Clearly I am missing something, because the project when converted to IS 2008 from IS 11 looses functionality.
0 Kudos
hidenori
Level 17

Could you email me your IS 11 and 2008 projects at hidenoriy@macrovision.com? I will look into it.

Thank you.
0 Kudos
hidenori
Level 17

The problem is that it is too late to set your database informaton to the text substitutions. You need to move the following code to the OnSQLServerInitialize() event before the SQLRTConnect() function call:

if (bEmpty) then
szBackup = SUPPORTDIR ^ "V12SE_EMPTY.BAK";
else
szBackup = SUPPORTDIR ^ "V12SE_DEMO.BAK";
endif;
szMDF = svDir ^ svDBText + ".MDF";
szLDF = svDir ^ svDBText + ".LDF";
TextSubSetValue( "", szBackup, TRUE );
TextSubSetValue( "", szMDF, TRUE );
TextSubSetValue( "", szLDF, TRUE );
TextSubSetValue( "", svDBText, TRUE);

Also, you need to change svDBText to szDB, and you need to eliminate the svDBText global string variable, or the sqlserverlselectlogindlg.rul file from your project. If it still does not work, please debug into your code to see if the text substitutions are correctly set as you expect.

Hope that helps.
0 Kudos
hidenori
Level 17

I worked with milan10 offline and we have solved the issue. The problem was that IS 2008 is designed to connect to the database specified in the SQLServerSelectLoginDlg dialog when clicking the Next button. IS 11 is designed to connect to the database specified in the SQL Scripts view which is blank in his case. He needed to change the code below in the OnSQLServerInitialize() event in order to get it working with IS 2008:

From:
SQLRTPutConnectionInfo2( szConnection, szServer, szDB, szUser, szPassword );

To:
SQLRTPutConnectionInfo2( szConnection, szServer, “”, szUser, szPassword );
0 Kudos