SetConnection
Syntax:
BOOL SetConnection(LPCTSTR
sConnName,
LPCTSTR
sConnStr);
Return
Value: TRUE if the
connection is set successfully, otherwise returns FALSE.
Parameters:
sConnName Specifies name of the connection to be passed to
ELS-QB.
sConnStr Specifies a connection string to be passed to
ELS-QB.
Remarks:
Call
this method to 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).
Example:
This
sample code shows how to change the connection string of the specified
connection at run time in ELS-QB component..
.........................
CString
strConn1 = _T(“Connection1”),
strConn2
= _T(“Connection2”),
strConnStr1
= m_QBCtrl.GetConnection(strConn1);
ChangeConnString(strConn2,
strConnStr1);
..............................
BOOL CELS_QBDemoView::ChangeConnString(CString& strConn,CString&
strConnStr)
{
CString
strCurrConnStr;
strCurrConnStr
= m_QBCtrl.GetConnection(strConn);
return
m_QBCtrl.SetConnection(strConn,
strConnStr);
}