This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Two SQL Dialogs
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 01, 2016
09:27 AM
Two SQL Dialogs
Hi ,
We have created an Installscript MSI project , in that we have one SQl connection which has few SQL scripts in it. From OnSQLLogin function we are calling SQLServerSelectLogin dialog.
Now we had a new task to Show two SQL Dialogs in some cases only , according to one Property(or can be a string) value we need to show the second SQL dialog otherwise no need to show the second SQL dialog.
Can anybody help us how to work on two SQL Dialogs ?
Thanks in advance.
We have created an Installscript MSI project , in that we have one SQl connection which has few SQL scripts in it. From OnSQLLogin function we are calling SQLServerSelectLogin dialog.
Now we had a new task to Show two SQL Dialogs in some cases only , according to one Property(or can be a string) value we need to show the second SQL dialog otherwise no need to show the second SQL dialog.
Can anybody help us how to work on two SQL Dialogs ?
Thanks in advance.
(10) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 01, 2016
12:02 PM
Behavior and Logic
InstallScript
Select Setup.rul
Find you dialog(s) in OnFirstUIBefore
Insert IF statement(s) to control flow
InstallScript
Select Setup.rul
Find you dialog(s) in OnFirstUIBefore
Insert IF statement(s) to control flow
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 01, 2016
02:19 PM
What rguggisberg said
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 02, 2016
03:19 AM
Hi rguggisberg,
We are having two SQL connections with names SQLConnection and PerfSQLConnection, we need to show PerfSQLConnection in only some conditions (say if string xyz="true"), can you suggest whether to write if condition in this case or to create another function similar to
OnSQLLogin function?
To be more clear we have 3 scenarios:
1)Need to show only SQLConnection related SQL dialog
2)Need to show both SQLConnection and PerfSQLConnection related SQL Dialogs,
3)Need to show only PerfSQLConnection related SQL Dialog.
Below is the Installscript code ,can you suggest where to make the changes if we go with IF condition as you mentioned in earlier comment?
//---------------------------------------------------------------------------
// OnSQLLogin
//---------------------------------------------------------------------------
function number OnSQLLogin( nBtn )
string sMessage;
string szConnection, szServer, szUser, szPassword, szDB, sTemp[MAX_PATH];
string szAuthentication,szNASVer,szSQLServerName,szInitialCatalog,szAuthenticationType,szSQLUserName,szSQLPassword;
number nResult, nSize, nCount;
BOOL bWinLogin, bNext, bPromptForSQLLoginInfo;
LIST listConnections;
number nvSize;
begin
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLSERVERADDRESS", szServer, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLSERVERLOGIN", szUser, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLSERVERPASSWORD", szPassword, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLAUTHENTICATION", szAuthentication, nvSize);
if (szAuthentication = "WINDOWS") then
bWinLogin = TRUE;
else
bWinLogin = FALSE;
endif;
//First initialize SQL Server runtime
SQLRTInitialize2();
// Suppress ISSQLSRV.DLL to show a connection error message.
MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_CA_SILENT", "1" );
//Get the names of all the necessary connections
listConnections = SQLRTGetConnections();
ListGetFirstString (listConnections, szConnection);
nCount = 0;
//determine if NEXT or BACK will be returned
//if there are no connections to make
if( nBtn != BACK ) then
bNext = TRUE;
else
bNext = FALSE;
//start at end if going BACK
while (ISERR_SUCCESS = ListGetNextString( listConnections, szConnection ) );
nCount++;
endwhile;
endif;
// Login for each connection
while (nResult = ISERR_SUCCESS)
//Get Default values for connection
SQLRTGetConnectionInfo( szConnection, szServer, szDB, szUser, szPassword );
// Use our Default, not SQL Servers
//bWinLogin = SQLRTGetConnectionAuthentication( szConnection );
// Display login dialog (without connection name)
// COMMENT OUT TO SWAP DIALOGS
//nResult = SQLServerSelectLogin2( szConnection, szServer, szUser, szPassword, bWinLogin, szDB, FALSE, TRUE );
// Display login dialog (with connection name)
// UNCOMMENT TO SWAP DIALOGS
//nResult = SQLServerSelectLogin2( szConnection, szServer, szUser, szPassword, bWinLogin, szDB, TRUE, TRUE );
// nResult = SQLServerSelectLogin(szServer, szUser, szPassword, bWinLogin);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "NASVER", szNASVer, nvSize);
if(szNASVer!="") then
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLSERVERADDRESS", szServer, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "IS_SQLSERVER_DATABASE", szInitialCatalog, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLAUTHENTICATION", szAuthentication, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLSERVERLOGIN", szUser, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLSERVERPASSWORD", szPassword, nvSize);
if (szAuthentication = "WINDOWS") then
bWinLogin = TRUE;
else
bWinLogin = FALSE;
endif;
nResult=NEXT;
else
nResult = SQLServerSelectLogin(szServer, szUser, szPassword, bWinLogin);
endif;
if( nResult = NEXT ) then
//store data in case we need it again
SQLRTPutConnectionInfo2( szConnection, szServer, szDB, szUser, szPassword );
SQLRTPutConnectionAuthentication( szConnection, bWinLogin );
//test connection
nResult = SQLRTTestConnection2( szConnection, szServer, szDB, szUser, szPassword, bWinLogin );
nSize = MAX_PATH;
MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_STATUS", sTemp, nSize );
if( sTemp != "0" ) then
nSize = _MAX_PATH;
MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_STATUS_ERROR", sMessage, nSize );
if( nSize = 0 ) then
Sprintf(sMessage, SdLoadString( IDS_IFX_SQL_ERROR_LOGIN_FAILED ), szConnection, SdLoadString( ISCRIPT_E_UNKNOWN_ERROR_DESC ));
endif;
MessageBox( sMessage, MB_OK );
//Show same login dialog again
nResult = ListCurrentString(listConnections, szConnection);
else //SUCCESS
//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;
endwhile;
MsiSetProperty(ISMSI_HANDLE, "SQLSERVERADDRESS", szServer);
MsiSetProperty(ISMSI_HANDLE, "SQLSERVERLOGIN", szUser);
MsiSetProperty(ISMSI_HANDLE, "SQLSERVERPASSWORD", szPassword);
if (bWinLogin = TRUE)then
MsiSetProperty(ISMSI_HANDLE, "SQLAUTHENTICATION", "WINDOWS");
else
MsiSetProperty(ISMSI_HANDLE, "SQLAUTHENTICATION", "SQL");
endif;
if( bNext ) then
return NEXT;
else
return BACK;
endif;
end;
We are having two SQL connections with names SQLConnection and PerfSQLConnection, we need to show PerfSQLConnection in only some conditions (say if string xyz="true"), can you suggest whether to write if condition in this case or to create another function similar to
OnSQLLogin function?
To be more clear we have 3 scenarios:
1)Need to show only SQLConnection related SQL dialog
2)Need to show both SQLConnection and PerfSQLConnection related SQL Dialogs,
3)Need to show only PerfSQLConnection related SQL Dialog.
Below is the Installscript code ,can you suggest where to make the changes if we go with IF condition as you mentioned in earlier comment?
//---------------------------------------------------------------------------
// OnSQLLogin
//---------------------------------------------------------------------------
function number OnSQLLogin( nBtn )
string sMessage;
string szConnection, szServer, szUser, szPassword, szDB, sTemp[MAX_PATH];
string szAuthentication,szNASVer,szSQLServerName,szInitialCatalog,szAuthenticationType,szSQLUserName,szSQLPassword;
number nResult, nSize, nCount;
BOOL bWinLogin, bNext, bPromptForSQLLoginInfo;
LIST listConnections;
number nvSize;
begin
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLSERVERADDRESS", szServer, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLSERVERLOGIN", szUser, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLSERVERPASSWORD", szPassword, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLAUTHENTICATION", szAuthentication, nvSize);
if (szAuthentication = "WINDOWS") then
bWinLogin = TRUE;
else
bWinLogin = FALSE;
endif;
//First initialize SQL Server runtime
SQLRTInitialize2();
// Suppress ISSQLSRV.DLL to show a connection error message.
MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_CA_SILENT", "1" );
//Get the names of all the necessary connections
listConnections = SQLRTGetConnections();
ListGetFirstString (listConnections, szConnection);
nCount = 0;
//determine if NEXT or BACK will be returned
//if there are no connections to make
if( nBtn != BACK ) then
bNext = TRUE;
else
bNext = FALSE;
//start at end if going BACK
while (ISERR_SUCCESS = ListGetNextString( listConnections, szConnection ) );
nCount++;
endwhile;
endif;
// Login for each connection
while (nResult = ISERR_SUCCESS)
//Get Default values for connection
SQLRTGetConnectionInfo( szConnection, szServer, szDB, szUser, szPassword );
// Use our Default, not SQL Servers
//bWinLogin = SQLRTGetConnectionAuthentication( szConnection );
// Display login dialog (without connection name)
// COMMENT OUT TO SWAP DIALOGS
//nResult = SQLServerSelectLogin2( szConnection, szServer, szUser, szPassword, bWinLogin, szDB, FALSE, TRUE );
// Display login dialog (with connection name)
// UNCOMMENT TO SWAP DIALOGS
//nResult = SQLServerSelectLogin2( szConnection, szServer, szUser, szPassword, bWinLogin, szDB, TRUE, TRUE );
// nResult = SQLServerSelectLogin(szServer, szUser, szPassword, bWinLogin);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "NASVER", szNASVer, nvSize);
if(szNASVer!="") then
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLSERVERADDRESS", szServer, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "IS_SQLSERVER_DATABASE", szInitialCatalog, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLAUTHENTICATION", szAuthentication, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLSERVERLOGIN", szUser, nvSize);
nvSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SQLSERVERPASSWORD", szPassword, nvSize);
if (szAuthentication = "WINDOWS") then
bWinLogin = TRUE;
else
bWinLogin = FALSE;
endif;
nResult=NEXT;
else
nResult = SQLServerSelectLogin(szServer, szUser, szPassword, bWinLogin);
endif;
if( nResult = NEXT ) then
//store data in case we need it again
SQLRTPutConnectionInfo2( szConnection, szServer, szDB, szUser, szPassword );
SQLRTPutConnectionAuthentication( szConnection, bWinLogin );
//test connection
nResult = SQLRTTestConnection2( szConnection, szServer, szDB, szUser, szPassword, bWinLogin );
nSize = MAX_PATH;
MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_STATUS", sTemp, nSize );
if( sTemp != "0" ) then
nSize = _MAX_PATH;
MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_STATUS_ERROR", sMessage, nSize );
if( nSize = 0 ) then
Sprintf(sMessage, SdLoadString( IDS_IFX_SQL_ERROR_LOGIN_FAILED ), szConnection, SdLoadString( ISCRIPT_E_UNKNOWN_ERROR_DESC ));
endif;
MessageBox( sMessage, MB_OK );
//Show same login dialog again
nResult = ListCurrentString(listConnections, szConnection);
else //SUCCESS
//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;
endwhile;
MsiSetProperty(ISMSI_HANDLE, "SQLSERVERADDRESS", szServer);
MsiSetProperty(ISMSI_HANDLE, "SQLSERVERLOGIN", szUser);
MsiSetProperty(ISMSI_HANDLE, "SQLSERVERPASSWORD", szPassword);
if (bWinLogin = TRUE)then
MsiSetProperty(ISMSI_HANDLE, "SQLAUTHENTICATION", "WINDOWS");
else
MsiSetProperty(ISMSI_HANDLE, "SQLAUTHENTICATION", "SQL");
endif;
if( bNext ) then
return NEXT;
else
return BACK;
endif;
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 03, 2016
09:21 AM
I suppose there are a number of ways to do what you need. I have a couple packages that have 2 database connections. I put my deterministic logic in OnFirstUIBefore (may need to import that into your Setup.rul). In there you will find your call(s) to SQL stuff. I used SQLServerSelectLogin2 for each database. I also added code to test the SQL connection.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 04, 2016
01:54 AM
Hi rguggisberg,
Can you please send the logic?
Can you please send the logic?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 04, 2016
08:41 AM
I have a lot of other things in mine. Lets start by you sending me your OnFirstUIBefore code in your Setup.rul. Go to:
Behavior and Logic
InstallScript
Select your Setup.rul (typical)
If you don't find OnFirstUIBefore anywhere in the window on the right, go to tool bar on right window and select the drop down in the left tab (probably has Initialization selected). Click on 'Before Move Data'. Now click on the right drop down and click on OnFirstUIBefore. If you look in there you will find the call to OnSQLLogin. So we need to set up another one of those. Post your OnFirstUIBefore.
Behavior and Logic
InstallScript
Select your Setup.rul (typical)
If you don't find OnFirstUIBefore anywhere in the window on the right, go to tool bar on right window and select the drop down in the left tab (probably has Initialization selected). Click on 'Before Move Data'. Now click on the right drop down and click on OnFirstUIBefore. If you look in there you will find the call to OnSQLLogin. So we need to set up another one of those. Post your OnFirstUIBefore.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 12, 2016
06:10 AM
Hi rguggisberg,
I could able to show two SQL Dialogs and could able to control the flow by creating similar function to OnSQLLogin. But one issue with this is not able to differentiate between the two dialogs , from both the functions we are calling SQLServerSelectLogin(szServer, szUser, szPassword, bWinLogin) dialog. Is there any way to differentiate the Dialog wording to tell the user which connection string they were entering the values?
I could able to show two SQL Dialogs and could able to control the flow by creating similar function to OnSQLLogin. But one issue with this is not able to differentiate between the two dialogs , from both the functions we are calling SQLServerSelectLogin(szServer, szUser, szPassword, bWinLogin) dialog. Is there any way to differentiate the Dialog wording to tell the user which connection string they were entering the values?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 15, 2016
10:54 AM
I use SQLServerSelectLogin2 (see the help for it). Then specify a connection name among parameters like this.
nResult = SQLServerSelectLogin2( szConnection, szServer, szUser, szPassword, bWinLogin, szDB, FALSE, TRUE );
nResult = SQLServerSelectLogin2( szConnection, szServer, szUser, szPassword, bWinLogin, szDB, FALSE, TRUE );
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 26, 2016
08:46 AM
Hi rguggisberg ,
After changing to SQLServerSelectLogin2( szConnection, szServer, szUser, szPassword, bWinLogin, szDB, TRUE , FALSE); , we are getting "CREATE TABLE permission denied in database 'master' " error message while installing in Azure machines.
After changing to SQLServerSelectLogin2( szConnection, szServer, szUser, szPassword, bWinLogin, szDB, TRUE , FALSE); , we are getting "CREATE TABLE permission denied in database 'master' " error message while installing in Azure machines.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 31, 2016
03:26 AM
Hi rguggisberg ,
We changed to SQLServerSelectLoginEx dialog which solved our problem, thank you for your inputs.
We changed to SQLServerSelectLoginEx dialog which solved our problem, thank you for your inputs.
![](/skins/images/3B39CE851FDD5528C393F146EB70A2D0/responsive_peak/images/icon_anonymous_message.png)