2008年2月5日星期二

DAO问题: Unrecognized database format

If you are linking with the MFC DLL, you can specify that you want MFC to use DAO 3.6 by inserting the following line of code before you open an Access 2000 database:

AfxGetModuleState()->m_dwVersion = 0x0601;


Insert this line in the CYourApp::Initinstance() function of your program.

If you are building with the static MFC libraries, following are the steps to get static builds of MFC to use DAO 3.6:
1. Modify the Daocore.cpp file in the MFC SRC directory. You will receive the following comment:

// Determine whether to use DAO 3.6, 3.5, or 3.0
// Use DAO 3.0 if DLL build and not built with MFC 4.21 or later
// Use DAO 3.6 if MFC 6.01 or later
// otherwise, DAO 3.5



Add the following lines:

#undef _MFC_VER
#define _MFC_VER 0x0601



2. Rebuild the library for the variant you need. For example, to build the static MFC library, debug version, non-Unicode, with no browser files use the following command at the command prompt in the MFC\SRC folder:

nmake DEBUG=1


for release:
nmake DEBUG=0


for unicode builds:
nmake DEBUG=1 UNICODE=1
nmake DEBUG=0 UNICODE=1

没有评论: