HRESULT hr = S_OK;
_bstr_t strConnection("Driver={SQL Server};SERVER=YUP;DATABASE=Maindb;UID=test;PWD=test");
_bstr_t user("");
_bstr_t pwd("");
_bstr_t strSql("Select * From GroupTable"); hr = m_connection.CreateInstance( _uuidof(Connection) );
hr = m_connection->Open(strConnection,user,pwd,16);
hr = m_recordset.CreateInstance( _uuidof(Recordset) );
try
{
hr = m_recordset->Open( strSql,
strConnection,
adOpenDynamic,
adLockOptimistic,
adCmdText );
}
catch(_com_error &e)
{
MessageBox(e.ErrorMessage());
}
_bstr_t strConnection("Driver={SQL Server};SERVER=YUP;DATABASE=Maindb;UID=test;PWD=test");
_bstr_t user("");
_bstr_t pwd("");
_bstr_t strSql("Select * From GroupTable"); hr = m_connection.CreateInstance( _uuidof(Connection) );
hr = m_connection->Open(strConnection,user,pwd,16);
hr = m_recordset.CreateInstance( _uuidof(Recordset) );
try
{
hr = m_recordset->Open( strSql,
strConnection,
adOpenDynamic,
adLockOptimistic,
adCmdText );
}
catch(_com_error &e)
{
MessageBox(e.ErrorMessage());
}
m_connection.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText );
m_connection.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText );