Console application and MFC DAO

Console application and MFC DAO

Post by Gadge » Sat, 24 May 1997 04:00:00



I want to write a simple console application to retrieve and display the
data from MDB files, using DAO classes.
But, I don't know which header files have to be included, what options
must be set up for project, which libraries have to be linked, which
jobs shouldn't be done, and so on. ^^;

Are there any special points to be checked?
Could you explain the steps for implementation?
Or, where can I get the sample source codes?

Please, help me!

Thank you.

 
 
 

Console application and MFC DAO

Post by Patrick Ne » Sat, 24 May 1997 04:00:00



> I want to write a simple console application to retrieve and display the
> data from MDB files, using DAO classes.
> But, I don't know which header files have to be included, what options
> must be set up for project, which libraries have to be linked, which
> jobs shouldn't be done, and so on. ^^;

> Are there any special points to be checked?
> Could you explain the steps for implementation?
> Or, where can I get the sample source codes?

> Please, help me!

> Thank you.

Gadget:

If you are looking for a .MDB->Web solution (I suspect because you are
building a console app; maybe a CGI?), you may wish to look at our
product which will save you all of the coding: Database2Net. We are
about to release the new version; contact me if you would like to take a
look at it.

Otherwise, the answers to your questions:

start your code with:
        HINSTANCE hMod = ::GetModuleHandle( "db2net.exe" );
        ASSERT( hMod );
        AfxSetResourceHandle( hMod );

(see MS knowledge base, look for "DAO" and "console")

end your code with:
        AfxDaoTerm( );
(if not in MFC, you must close Jet explicitly. Addressed in same article
as above.)

include this:
        #include <afxdao.h>                       // MFC DAO classes

I think that is all you need. In addition, just use CDAODatabases and
CDAORecordsets as you need them.

Patrick Nee