Click here to Skip to main content
16,022,971 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
class IAlarmDatabase
{
public:
  IAlarmDatabase()        {}
  virtual~IAlarmDatabase(){}
  virtual bool OpenConnect(string strDataSource, string strUID, string strPwd) = 0;
  virtual bool ExecuteSql	(string strSql) = 0;
};

class CAlarmDatabase:public IAlarmDatabase
{
public:
	CAlarmDatabase();
	~CAlarmDatabase();
public:
	static CAlarmDatabase*	Instance();
	bool OpenConnect(string strDataSource, string strUID, string strPwd);
	bool ExecuteSql(string strSql);
protected:
	static auto_ptr<calarmdatabase> m_ADOInstance;
	_ConnectionPtr	m_pConnect;
	_RecordsetPtr	m_pRecordset;

};
</calarmdatabase>

the class is designed to operate oracle database!
someone tell me why?
Posted
Updated 20-Jun-10 22:09pm
v2
Comments
[no name] 21-Jun-10 4:12am    
Why not?
Abhinav S 21-Jun-10 4:17am    
Reason for my vote of 1
Are you asking for help? Looks like are you trying to post this question as a quiz to test others.

of course not!I post the question with some languages that our website can't recognize so ...

What I what to ask is I Create a _ConnectionPtr object and call it's open method to open a connection with the oracle database,but as the code up there,When I shut the app a _com error occurs?why ? the _connectionPtr can't release itself?
 
Share this answer
 
You should call m_pConnect->Close() before releasing it.
Here: ~CAlarmDatabase(), is a good place.
 
Share this answer
 
Comments
happydebug 21-Jun-10 5:53am    
I have tried!But it doesn't work either!
Maybe it due to the singleton mode,I use a sington class to operate oracle
Niklas L 21-Jun-10 7:40am    
...and you don't have any open record sets?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900