SQLRTTestConnection

InstallShield 2016 » InstallScript Language Reference

Project • This information applies to InstallScript MSI projects.

The SQLRTTestConnection2 function supersedes the SQLRTTestConnection function.

The SQLRTTestConnection function tests all of the connections specified in the installation using the specified credential.

Note • If you want to call any built-in SQL-related function before the OnSQLServerInitialize event handler is called in an InstallScript project or the OnSQLLogin event handler is called in an InstallScript MSI project, call the SQLRTInitialize2 function first. To learn more, see Using the SQL Run-Time Functions in InstallScript and InstallScript MSI Projects.

Syntax

SQLRTTestConnection( szServer, szDB, szUserName, szPassword, bTrust );

Parameters

SQLRTTestConnection Parameters

Parameter

Description

szServer

Specifies the SQL Server.

szDB

Specifies the catalog.

szUserName

Specifies the SQL Server login information.

szPassword

Specifies the password associated with a user account.

bTrust

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.

Return Values

SQLRTTestConnection Return Values

Return Value

Description

=ISERR_SUCCESS

This function was able to establish a connection.

SQL_ERROR_NOT_INITIALIZED

ISSQLSRV.dll is not loaded.

Additional Information

The result is used to set the value of the IS_SQLSERVER_STATUS property. Possible values are listed in the following table.

IS_SQLSERVER_STATUS Property Values

Return Value

Description

0

The function was able to establish one or more connections.

1

The function failed to establish a connection.

2

The function was able to establish a connection, but it failed to retrieve the product version from the target database server.

3

The function was able to establish a connection, but the version requirement was not met.

4

The function was able to establish a connection, but MSDE or the Express version was not allowed.

5

The function was able to establish a connection, but it failed to retrieve the schema version from the target database catalog.

6

The function was able to establish a connection, but it failed to set the schema version to the target database catalog.

7

The function could not find the specified ODBC driver.

8

The function was able to establish a connection to the default database catalog, but it failed to create the target database catalog (when Create Catalog If Absent check box in the SQL Scripts view is selected).

9

The function was able to establish a connection to the default database catalog, but it failed to connect to the target database catalog.

10

The function could not find a valid record in ISSQLDBMetaData table.

See Also