Dear All!

I need more information about the CCommand object's lifetime.
I just want to know whether the CCommand object's lifetime is within
the session object's life time or it's life time is beyond the session
object's lifetime. because I want to close the session connection (to
reuse) before manipulate the CComand objects record sets. Please throw
your comments for the following code,

the code is as follows,

CDataSource m_DS;

CSession m_Session;

CCommand<CDynamicParameterAccessor, CRowset, CMultipleResults>
m_Cmd;

CDBPropSet dbinit(DBPROPSET_DBINIT);

dbinit.AddProperty(DBPROP_INIT_DATASOURCE, "MyDSN" );

dbinit.AddProperty(DBPROP_INIT_PROMPT, (short)4);

dbinit.AddProperty(DBPROP_INIT_LCID, (long)1033);

hr = m_DS.Open(_T("MSDASQL"), &dbinit);

hr = m_Session.Open( m_DS );

hr = m_cmd.Open(m_session, _T("SELECT * FROM PROJECTS ORDER BY
PROJECT_ID"),NULL);

m_session.close();

hr = m_cmd.MoveFirst();

do
{
hr = m_cmd.MoveNext();
}
while ( hr == S_OK );