C++ encapsulation class for ADO
Hi,
I am looking for a good C++ encapsulation class for ADO. Just like CDatabase/CRecordset for ODBC and CDAODatabase/CDAORecordset for DAO. It is better to have a CADODatabase/CADORecordset for ADO to simplify the using of ADO in C++/MFC project.
I find one at Codeproject http://www.codeproject.com/Articles/...s-version-2-20 . However, that works only for Visual Studio 6.0, so is outdated. Are there any similar encapsulation class works for Visual Studio 2008/2010?
I can accept either free source codes or paid third-party classes or libraries, if any.
Thanks
Re: C++ encapsulation class for ADO
Which parts of this class do NOTwork for Visual Studio 2008/2010?
Re: C++ encapsulation class for ADO
Check out the ATL OLEDB Consumer classes. To use, right click on the project in the solution explorer, choose "Add Class", choose "ATL" and select the ATL OLEDB Consumer class.
This class (like ADO) requires COM support, you can easily add this by choosing the Add ATL Support to MFC new class option.
Re: C++ encapsulation class for ADO
First of all, the CodeProject classes are not compatible with Unicode. After making necessary modifications, I rebuild it but get more compiler errors under VS2008(such as ambiguous calls to overloaded function, etc.). So I believe it is not compatible with VS2008. While the same code base can be built under VS6.
Thanks
Re: C++ encapsulation class for ADO
Quote:
Originally Posted by
AlanCCC
First of all, the CodeProject classes are not compatible with Unicode. After making necessary modifications, I rebuild it but get more compiler errors under VS2008(such as ambiguous calls to overloaded function, etc.). So I believe it is not compatible with VS2008. While the same code base can be built under VS6.
Thanks
That's only because VS2008 projects default to UNICODE; whereas VC6 projects do not. Change the compiler to build for UNICODE in VC6 and you'll see the same errors if the classes didn't use the _T() or TEXT() macros internally.
Re: C++ encapsulation class for ADO
Alan, at any rate, the sample code you have relies on older ADO libraries. Plus the sample is 8 years old.
Why not try the ATL OLEDB Consumer approach I posted earlier?
Re: C++ encapsulation class for ADO
The ATL OLEDB cusumer class seems must to be bound with a given data source. While my application will open and access the data source dymanically.
Re: C++ encapsulation class for ADO
Quote:
Originally Posted by
AlanCCC
The ATL OLEDB cusumer class seems must to be bound with a given data source. While my application will open and access the data source dymanically.
Um, kind of. It will be bound to the same database schema, but not to same data source. You can open a connection to different data sources by changing the connection string.