现在实习,要做个系统,我用了DAO来做,用ACCESS来建数据库,可却报错,说数据库格式不对,后来我知道VC6不支持ACCESS 2000/XP,可我都做了一大半了,急死了,请问有什么办法吗?

解决方案 »

  1.   

    #undef _MFC_VER
    #define _MFC_VER 0x0601 #ifdef _AFXDLL
    AfxGetModuleState()->m_dwVersion = 0x0601;
    #else
      
    #endif // _AFXDLL 
    AfxDaoInit();
    //AfxGetModuleState 是对dao 350,360对access2000的兼容性设置
    BOOL CMisApp::InitInstance()
    在这上加上就行了不过要用MFC 的DLL 才行要用LIB 
    要从新编译 MFC 类库
    不过我的没编译通MSDN 中有说明
    Using Access 2000 Databases with MFC 6.0.
    MFC 6.0 has the ability to use Microsoft Access 2000 databases. To engage this support in your application, you must enable DAO 3.6 by: 
    Linking with the DLL version of MFC and adding the following line to InitInstance before you make any database-related calls: AfxGetModuleState()->m_dwVersion = 0x0601 
    - or - 
    Recompile the MFC static libs with _MFC_VER set to 0x0601.
    FIX: DAO 3.6 Causes Debug Errors in MFC DAO Non-Unicode Builds [visualc]
      

  2.   

    对了你要是编译通通了通知我一下
    MSN:[email protected]
      

  3.   

    把数据库的格式换成ACCESS97的就可以了,ACCESS97格式的数据库需要DAO350.DLL的支持,但是在2000和和XP下可能没有安装和注册DAO350.DLL,要保证你的程序在2000和XP下也能正常的访问ACCESS97数据库,需要带上DAO350.DLL并注册这个动态库,这可以在制作安装程序时设置若不想改变数据库格式,则改用ADO做吧,它可以任意选择各种数据库引擎,通用性比DAO要好
      

  4.   

    如何转成97格式,要用ACCESS 97吗?能解释一下吗
      

  5.   

    在ACCESS 2000的工具里就有转换呀,你看一下就知道了.
      

  6.   

    做一个PAGE ,然后查看原文件.
    找到里面的连接字符串,再改用ADO就可以了.