PDA

View Full Version : Multiple SQLLogin Dialogs



MelBaz
07-10-2007, 02:59 AM
Hello
In my install shield project there are two SQL connections; I want to display SQLLogin Dialog for each.
How can this be done?
Project info:
Basic MSI Project
Install Shield 2008

thanks alot

hidenori
07-11-2007, 11:47 AM
InstallScript and InstallScript MSI projects will display One SQL Login dialog for every SQL Server connection. Basic MSI projects will display One SQL Login dialog only, even if multiple connects are present. The rest of the connections will still be validated, but they will use the authentication information entered at design time. To display 2 SQL connection dialogs at runtime, one for each connection, do the following:

Add 2 SQLConnections to the SQL Servers view.
For every field that is different between the 2 connections, assign a unique property name. For example, if these 2 connections connect to 2 different servers but the database name and the authentication information is the same, then create a new property for the Server name. Assign it to the second connection from the advanced tab.
Add the property: IS_SQLSERVER_CONNECTIONS_TO_VALIDATE
Go to the Dialog editor and expand the SQLLogin dialog.
Add the following event to the Next button and place it before the DoAction event:
[IS_SQLSERVER_CONNECTIONS_TO_VALIDATE] <Connection2> 1
where <Connection2> is the name of the second connection you want to validate.
Rename SQLLogin to SQLLogin2.
Export SQLLogin2 to a dialog file.
Rename SQLLogin2 to SQLLogin.
Change <Connection2> of the event you added to <Connection1> where <Connection1> is the name of the first connection you want to validate.
Import SQLLogin2 from the dialog file you exported earlier.
On the English node(or whatever language you are working in) of SQLLogin2, change any control you specified a new value for in step 2 to use that property. For example, if in step 2 you created a new property for the server name, change the Property of cboServers to the property you created in step 2.
Change the event for the Next button of the SQLLogin dialog to display the SQLLogin2 dialog.
Change the event for the Next button of the SQLLogin2 dialog to display the SetupType dialog, and the Back button to display the SQLLogin dialog.
Change the event for the Back button of the SetupType dialog to display the SQLLogin2 dialog.

These same steps could be used to add 3 or more SQLLogin2 dialogs.

MelBaz
07-15-2007, 05:58 AM
:o Thanks alot

MelBaz
07-26-2007, 06:56 AM
:confused:

i dont know why .........

hidenori
07-26-2007, 01:11 PM
Please try this:


Add the following event to the BtnDbBrowse button on the SQLLogin dialog and place it before the DoAction event:
[IS_SQLSERVER_CONNECTIONS_TO_VALIDATE] <Connection1> 1
where <Connection1> is the name of the first connection you want to validate

Add the following event to the BtnDbBrowse button on the SQLLogin2 dialog and place it before the DoAction event:
[IS_SQLSERVER_CONNECTIONS_TO_VALIDATE] <Connection2> 1
where <Connection2> is the name of the second connection you want to validate.

Sayantan
11-15-2007, 08:15 AM
InstallScript and InstallScript MSI projects will display One SQL Login dialog for every SQL Server connection. Basic MSI projects will display One SQL Login dialog only, even if multiple connects are present. The rest of the connections will still be validated, but they will use the authentication information entered at design time. To display 2 SQL connection dialogs at runtime, one for each connection, do the following:

Add 2 SQLConnections to the SQL Servers view.
For every field that is different between the 2 connections, assign a unique property name. For example, if these 2 connections connect to 2 different servers but the database name and the authentication information is the same, then create a new property for the Server name. Assign it to the second connection from the advanced tab.
Add the property: IS_SQLSERVER_CONNECTIONS_TO_VALIDATE
Go to the Dialog editor and expand the SQLLogin dialog.
Add the following event to the Next button and place it before the DoAction event:
[IS_SQLSERVER_CONNECTIONS_TO_VALIDATE] <Connection2> 1
where <Connection2> is the name of the second connection you want to validate.
Rename SQLLogin to SQLLogin2.
Export SQLLogin2 to a dialog file.
Rename SQLLogin2 to SQLLogin.
Change <Connection2> of the event you added to <Connection1> where <Connection1> is the name of the first connection you want to validate.
Import SQLLogin2 from the dialog file you exported earlier.
On the English node(or whatever language you are working in) of SQLLogin2, change any control you specified a new value for in step 2 to use that property. For example, if in step 2 you created a new property for the server name, change the Property of cboServers to the property you created in step 2.
Change the event for the Next button of the SQLLogin dialog to display the SQLLogin2 dialog.
Change the event for the Next button of the SQLLogin2 dialog to display the SetupType dialog, and the Back button to display the SQLLogin dialog.
Change the event for the Back button of the SetupType dialog to display the SQLLogin2 dialog.

These same steps could be used to add 3 or more SQLLogin2 dialogs.

Any one can tell me how to Add the following event to the Next button and and how to place it before the DoAction event:
[IS_SQLSERVER_CONNECTIONS_TO_VALIDATE] <Connection2> 1
where <Connection2> is the name of the second connection you want to validate.

Because i could not edit dialog box code except its layout from user interface menu.

hidenori
11-16-2007, 12:39 AM
You need to select the Dialog Behavior node under the SQLLogin dialog, and select the Next control from the table of the controls in the middle pain. In the right pain, you can add a new control event by clicking the last row.

Hope that helps.

Sayantan
11-16-2007, 06:27 AM
You need to select the Dialog Behavior node under the SQLLogin dialog, and select the Next control from the table of the controls in the middle pain. In the right pain, you can add a new control event by clicking the last row.

Hope that helps.

Hi,

Thanks for your quick response but sorry i could not get it.......
Please keep it in your mind I am not an expert on that....

I could not find any dialog Behavior node there ........
when i right click on the sqlserverdialog form it gives me edit option along with some export from file etc. option
and where from i can only change its control. properties....nothing else.....

I basically want to see its scripting code of that form.....

where I want to add my own check box option before the connection string

1) For MS SQL Server
2) For My SQL

and want to toggling the connection string value according to user choice....

Please help me out how could i achieved that.....

hidenori
11-20-2007, 10:12 AM
Which project type are using an InstallScript project or an InstallScript MSI project? The instruction provided in this thread is for Basic MSI projects.

Sayantan
11-23-2007, 05:16 AM
Which project type are using an InstallScript project or an InstallScript MSI project? The instruction provided in this thread is for Basic MSI projects.

I am working on Installscript MSI Project,and i could not find the Dialog Behavior link there only i can see the Edit Dialog Layout link.

I am using Installshield 2008 Professional edition (ver. 14).

That's why i could not modify the action of any dialog contrl.

Please any one tell me how to modify dialog behavior in my version.

Sayantan
11-26-2007, 06:38 AM
IIf you are using an InstallScript project, you can skip to establish specific connections at run-time. In OnSQLServerInitialize() event, you can add the code conditioning whether to connect to a SQL server or not.

What you need to do is to test the value of szConnection after you get the connection information from SQLRTGetConnectionInfo( szConnection, szServer, szDB, szUser, szPassword ). The szConnection is the connection name that you have specified in the SQL Scripts view. If you have 2 connections named ORACLE_CONNECTION and MS_CONNECTION in the view and you don't want to establish the ORACLE_CONNECTION connection, your code will look like this:

(The lines highlighted in bold are the code you will need to add)

while (nResult = ISERR_SUCCESS)

//Get Default values for connection
SQLRTGetConnectionInfo( szConnection, szServer, szDB, szUser, szPassword );

if( szConnection = "MS_CONNECTION") then

bWinLogin = SQLRTGetConnectionAuthentication( szConnection );

// Display login dialog (without connection name)
nResult = SQLServerSelectLogin( szServer, szUser, szPassword, bWinLogin );


if( nResult = NEXT ) then

//store data in case we need it again
SQLRTPutConnectionInfo( szConnection, szServer, szUser, szPassword );

//try connection
nResult = SQLRTConnect2( szConnection, szServer, bWinLogin, szUser, szPassword, szDatabaseServer );

if( nResult < ISERR_SUCCESS ) then
.
.
.
else
.
.
//Move on to next connection
nCount++;
bNext = TRUE;
nResult = ListGetNextString(listConnections, szConnection);
endif;
else
//BACK
nCount--;
bNext = FALSE;
nResult = ListSetIndex( listConnections, nCount );
ListCurrentString( listConnections, szConnection );
endif;
else
if( bNext = TRUE ) then
//Move on to next connection
nCount++;
nResult = ListGetNextString(listConnections, szConnection);
else
//BACK
nCount--;
nResult = ListSetIndex( listConnections, nCount );
ListCurrentString( listConnections, szConnection );
endif;
endif;

endwhile;
.


Could you pls let me know how would i use this code in my project ,i have 2 separate connection STRING 1) MS SQL SERVER 2) MySQL

hidenori
11-26-2007, 03:51 PM
In an InstallScript MSI project, you need to modify the OnSQLLogin() event. You can bring the code to your InstallScript by selecting the Before Move Data | OnSQLLogin from the dropdown boxes located upper side of the InstallScript editor.

Charlieh
04-22-2009, 06:39 AM
I have an InstallScript MSI project but would like to know what I need to change in OnSQLLogin to get the Oracle bits working. I've read on other posts that the SQL dialogs only work with SQL, if this is the case then how do you test a connection to Oracle?:confused:

hidenori
04-22-2009, 11:03 AM
Charlieh,

In order to target an Oracle database server, you just need to select the Oracle checkbox in the Requirements tab for your connection in the SQL Scripts view.

Charlieh
04-23-2009, 01:45 AM
Hi,

Thanks for you reply. That's what I thought but despite the fact I have an Oracle entry within the SQL Scripts section and have the Oracle bit checked no Oracle servers are being listed in the browse button. I did post another thread about how you go about testing an Oracle connection via the script as I have customised SdShowEditDlg3 to ask for the DB, Username & Password as I couldn't get Oracle servers to be listed in SQLLogin. I have the Oracle client on the pc which I run the install so any ideas why I can't see Oracle servers?

Charlieh
04-23-2009, 04:15 AM
More info for you. The machine I run my install on has SQL and Oracle installed on it and it seems to be only listing the SQL servers. Is this supposed to happen? My project type is Installscript msi and I created a new msi install with just an oracle entry in the SQL Scripts view and when I ran that install on my pc it listed nothing in the Database server dropdown or in the browse option, what am I missing?

hidenori
04-23-2009, 10:29 AM
Due to a technical limitation, only Oracle service names that are configured in the local tnsnames.ora will be listed in the SQLBrowse dialog. If you configure tnsnames.ora correctly and you don't see the service names on the SQLBrowse dialog in your setup, please try this:


Create an InstallScript MSI project.
Add a connection in the SQL Scripts view.
Select only the Oracle checkbox in the Requirements view.
Build and run the setup.
On the SQLLogin dialog, click the Browse button next to the Server Name field.
Observe.

Charlieh
04-27-2009, 02:54 AM
I have followed your instructions and I still can't get any oracle servers to appear in the browse window. How would I know if my tnsnames.ora was correctly configured? :confused:

hidenori
04-28-2009, 10:39 AM
You can check it by creating a DSN as follows:

Install Oracle ODBC driver provided from Oracle.
Open the Administrative Tools | Data Source (ODBC) from the Control Panel.
Click the Add button in the User DSN tab.
Select the "Oracle in OraDb10g_home1" and click the Finish button.
Check to see if you have a list of service names in the TNS Service Name dropdown list.

Charlieh
04-29-2009, 02:40 AM
Hi Hidenori,
Thanks for taking the time to respond again, I've tried those 5 steps and I do see the 2 TNS Service names in my dropdown but when I run the install again they are not listed, do you have any more ideas?

Failing this, please could you tell me what connection string I could use in the script to connect to an Oracle DB as I have customised the SDShowEditDlg3 which I thought I could use instead., cheers, Charlie :confused:

Charlieh
04-29-2009, 07:24 AM
To add to this I've also followed the points you made in this thread and the lst of Oracle servers still doesn't appear, I am able to connect with URL //host: [port] [/service name] though:

http://community.installshield.com/showthread.php?t=186706&page=2&highlight=ORACLE_HOME

ntabari
08-16-2010, 03:18 AM
hi there.

i have followed the instructions for the basic msi project and it does work the problem is even after following the a 2nd tip the dbname and dbserver buttons dont work properly on the second sqllogin dialog. i have checked and it updates the previous property not the one i have made.
i changed on the 2nd dialog
IS_SQLSERVER_LIST [IS_SQLSERVER_DATABASE] 1
to
IS_SQLSERVER_LIST [IS_SQLSERVER_DATABASE_2] 1

and still it updates [IS_SQLSERVER_DATABASE] instead of [IS_SQLSERVER_DATABASE_2]