tags:

views:

39

answers:

1

Hi, I have created an ATL Project with all default options using VC++ 2008.

I have added Simple ATL object (interface IDemo) and some interface moethos inside the simple object.

I want to use MFC classes (e.g. CDatabase, CRecordset and lots more) inside my ATL project.

How can I achieve this?

Thanks.

A: 

Nearly the only reasonable answer is "don't do that". ATL has OLE DB consumer templates of its own. If you want data access from an ATL project, those are the ones to use. If you're going to use MFC, make it an MFC project and be done with it.

One of the major arguments aginst MFC is that it's difficult (borders in impossible in some cases) to separate individual pieces of it out from the rest and use them in isolation.

Jerry Coffin
Thanks for reply.But my need is to create a simple COM component and check whether a database (SQL server) is up or not strictly using ODBC (and not OLEDB).How can I achieve this?
@user196614:In that case, I'd probably just use MFC for the whole thing. ATL saves a bit on load time, but the difference is generally pretty insignificant (by current standards). (Also, just to check, you do realize that OLE DB can talk to ODBC data sources, right?)
Jerry Coffin