OpenConnection
Syntax:
BOOL OpenConnection(LPCTSTR
sDummyConnName, LPCTSTR sConnStr);
Return
Value: TRUE if the
internal connection string variable is well defined and the connection has been
opened successfully, otherwise the returned value is FALSE
Parameters:
sDummyConnName
Pointer
to a string representing default connection name.
sConnStr Pointer
to a string representing the connection string. This string may be the empty
string, in which case the SetConnection function must be used to
define the proper connection string. Otherwise, sConnStr must contain a proper
connection string.
Remarks:
Call
this method to define and open a new dynamic connection specified by the sConnStr connection string.
Example:
This following code demonstrates how to create, save and
close connectiondynamically
in ELS-QB component..
.........................
CString strConnName = _T(“Northwind”),strConnStr;
//
Sample connection string
strConnStr
= _T(“Provider=SQLOLEDB.1;”)
_T(“Persist
Security Info=False;”)
_T(“User
ID=sa;”)
_T(“Initial
Catalog=Northwind;”)
_T(“Data
Source=SERVER1”);
if(m_QBCtrl.OpenConnection(strConnName,
strConnStr))
{
m_QBCtrl.SaveConnection();
m_QBCtrl.CloseConnection();
}