How can I tell if an ADODB::_RecordsetPtr has already been created?
- by scottm
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?