SQLRTConnectDB

InstallShield 2022 » InstallScript Language Reference

Project:This information applies to InstallScript projects.

To establish a connection to a specific catalog, replace the SQLRTConnect2 function call in the OnSQLServerInitialize event with the SQLRTConnectDB function call. Pass the catalog name as the szDB parameter for SQLRTConnectDB.

If you want end users to be able to specify the catalog at run time, pass an end user–defined variable as szDB.

Note:The SQLRTConnectDB function uses SQLRT.dll; therefore, it can be called only after SQLRTInitialize2 has already been called. To learn more, see Using the SQL Run-Time Functions in InstallScript and InstallScript MSI Projects.

Syntax

SQLRTConnectDB( szConnection, szDB, szServer, bWinLogin, szUser, szPassword );

Parameters

SQLRTConnectDB Parameters

Parameter

Description

szConnection

Specifies the SQL Server connection.

szDB

Specifies the catalog that you want to connect to.

To specify multiple catalogs, separate each with a semicolon (;).

If you want end users to be able to specify the catalog at run time, pass an end user–defined variable as szDB.

szServer

Specifies the SQL Server.

bWinLogin

Specifies the initial state of the radio buttons specifying login using Windows credentials vs. SQL Server credentials. When this is TRUE, the password and login ID fields are disabled. When it is FALSE, indicating that SQL Server credentials are to be used, the password and login fields are enabled.

Once the function returns, this parameter contains TRUE if the Windows credentials radio button was specified by the end user and FALSE if the SQL Server credentials radio was selected instead.

szUser

Specifies the SQL Server login information.

szPassword

Specifies the password associated with a user account.

Return Values

SQLRTConnectDB Return Values

Return Value

Description

>=ISERR_SUCCESS

This function was able to establish a connection.

<ISERR_SUCCESS

This function failed to establish a connection.

SQL_ERROR_NOT_INITIALIZED (-10)

SQLRT.dll is not loaded.

See Also