Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
|
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 29th, 2005, 12:13 PM
Registered User
 
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default CCommand Lifetime

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 );












Similar Threads
Thread Thread Starter Forum Replies Last Post
Hashtable and lifetime of objects inside luca C# 3 February 19th, 2007 07:33 AM
Threads and an objects lifetime Kep C# 3 May 18th, 2004 01:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.