cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
MelBaz
Level 3

Multiple SQLLogin Dialogs

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

Labels (1)
0 Kudos
(21) Replies
hidenori
Level 17

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:
[LIST=1]
  • 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] 1
    where 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 of the event you added to where 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.
  • 0 Kudos
    MelBaz
    Level 3

    😮 Thanks alot
    0 Kudos
    MelBaz
    Level 3

    :confused:

    i dont know why .........
    0 Kudos
    hidenori
    Level 17

    Please try this:

    [LIST=1]
  • Add the following event to the BtnDbBrowse button on the SQLLogin dialog and place it before the DoAction event:
    [IS_SQLSERVER_CONNECTIONS_TO_VALIDATE] 1
    where 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] 1
    where is the name of the second connection you want to validate.
  • 0 Kudos
    Sayantan
    Level 3

    hidenori wrote:
    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:
    [LIST=1]
  • 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] 1
    where 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 of the event you added to where 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] 1
    where 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.
    0 Kudos
    hidenori
    Level 17

    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.
    0 Kudos
    Sayantan
    Level 3

    hidenori wrote:
    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.....
    0 Kudos
    hidenori
    Level 17

    Which project type are using an InstallScript project or an InstallScript MSI project? The instruction provided in this thread is for Basic MSI projects.
    0 Kudos
    Sayantan
    Level 3

    hidenori wrote:
    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.
    0 Kudos
    Sayantan
    Level 3

    Sayantan wrote:

    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
    0 Kudos
    hidenori
    Level 17

    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.
    0 Kudos
    Charlieh
    Level 3

    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:
    0 Kudos
    hidenori
    Level 17

    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.
    0 Kudos
    Charlieh
    Level 3

    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?
    0 Kudos
    Charlieh
    Level 3

    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?
    0 Kudos
    hidenori
    Level 17

    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:

    [LIST=1]
  • 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.
  • 0 Kudos
    Charlieh
    Level 3

    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:
    0 Kudos
    hidenori
    Level 17

    You can check it by creating a DSN as follows:
    [LIST=1]
  • 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.
  • 0 Kudos
    Charlieh
    Level 3

    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:
    0 Kudos
    Charlieh
    Level 3

    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
    0 Kudos