SetConnection 

Syntax

object.SetConnection  sConnName,  sConnStr

sConnName        String that specifies the name of an existing connection node.

sConnStr            String that specifies a connection string to be passed to sConnName.

Description

Call this method pass a connection string to a connection object before instantiation. This function may be used to set the connection string before opening or instantiating a connection (see OpenConnection).

Remarks

SetConnection method returns True if the connection is set successfully, otherwise returns False.

Example

This sample code shows how to change the connection string of the specified connection at run time in ELS-QB component..

‘.........................

Dim sConn1, sConn2, sConnStr1

sConn1 = “Connection1”

sConn2 = “Connection2”

sConnStr1 = ELS_QBCtrl.GetConnection(sConnStr1)

ChangeConnString sConn2, sConnStr1

‘..............................

Private Function ChangeConnString(sConn As String, sConnStr As String) As Boolean

ChangeConnString = True

Dim sCurrConnStr

sCurrConnStr = ELS_QBCtrl.GetConnection(strConn)

If sCurrConnStr <> sConnStr Then

ChangeConnString =ELS_QBCtrl SetConnection(strConn, strConnStr)

End If

  End Function