DAO Database Engine Initialization and Termination

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at DAO Database Engine Initialization and Termination.

When using MFC DAO objects, the DAO database engine must first be initialized and then terminated before your application or DLL quits. Two functions, AfxDaoInit and AfxDaoTerm, perform these tasks.

DAO Database Engine Initialization and Termination

AfxDaoInit Initializes the DAO database engine.
AfxDaoTerm Terminates the DAO database engine.

AfxDaoInit

This function initializes the DAO database engine.

 
void AfxDaoInit();

throw(CDaoException*);  

Remarks

In most cases, you don't need to call AfxDaoInit because the application automatically calls it when it is needed.

For related information, and for an example of calling AfxDaoInit, see Technical Note 54.

AfxDaoTerm

This function terminates the DAO database engine.

 
void AfxDaoTerm();  

Remarks

Typically, you only need to call this function in a regular DLL; an application will automatically call AfxDaoTerm when it is needed.

In regular DLLs, call AfxDaoTerm before the ExitInstance function, but after all MFC DAO objects have been destroyed.

For related information, see Technical Note 54.

See Also

Macros and Globals