How can I tell if an ADODB::_RecordsetPtr has already been created?
Posted
by scottm
on Stack Overflow
See other posts from Stack Overflow
or by scottm
Published on 2010-03-11T21:01:46Z
Indexed on
2010/03/11
21:04 UTC
Read the original article
Hit count: 199
I am trying to write a class that uses ADO to retrieve SQL records. The intent is for the class to maintain one private recordset an other methods move forward, retrieve fields, etc. This is a basic example of my class:
class SqlADO {
private:
ADODB::_RecordsetPtr m_recordset;
public:
void Open(); //open the connection
void Execute(const char* sql); // creates or replaces current recordset
void Next(); //moves recordset cursor forward
void Field(const char* fieldName); //retrieves field name from current record of the recordset
};
My Questions:
- In the Execute method, how can I check to see that the recordset instance has been created (or do I need to) so that I can close it first?
- Do you know of any good ADO COM Interop references?
© Stack Overflow or respective owner