VC 如何操作ACCESS 2000 数据库?? 要下载什么布丁么??

解决方案 »

  1.   

    m_pConnection.CreateInstance(__uuidof(Connection));
    m_pConnection->ConnectionTimeout = 60;
    m_pConnection->Mode = adModeReadWrite; CString strConnection(_T("DRIVER={Microsoft Access Driver (*.mdb)};DBQ="));
    TCHAR buf[100];
    ZeroMemory(buf, sizeof(buf)/sizeof(TCHAR));
    ::GetModuleFileName((HMODULE)AfxGetInstanceHandle(), buf, sizeof(buf)/sizeof(TCHAR));
    CString strPath = buf;
    int n = strPath.GetLength();
    TCHAR cName[] = TEXT("CompanyData.exe");
    strPath.Delete(n-sizeof(cName)/sizeof(TCHAR) +1, sizeof(cName)/sizeof(TCHAR));
    strPath = strPath + '\\' + "company.mdb";
    strConnection += strPath;
    m_strCon = strConnection; try 
    {
    m_pConnection->ConnectionString = _bstr_t(strConnection);
    m_pConnection->Open( "", "", "", -1); }
    catch ( _com_error &e )
    {
    _bstr_t bstrSource(e.Source());
    _bstr_t bs =  _bstr_t(" Error: ") + _bstr_t(e.Error()) + _bstr_t(" Msg: ") 
    + _bstr_t(e.ErrorMessage()) + _bstr_t(" Description: ") 
    + _bstr_t(e.Description());
    MessageBox(NULL, bs, bstrSource, MB_OK);
    return FALSE;
    }
      

  2.   

    使用odbc吧   api  跟mfc都能完成的
      

  3.   

    不用补丁,用ODBC API对数据库进行底层操作,轻松搞定。
      

  4.   

    不用补丁,用ODBC API对数据库进行底层操作,轻松搞定。具体怎么做??
      

  5.   

    //Access2000 database and DAO
    To read Access 2000mdb, i added the following code : 
    AfxGetModuleState()->m_dwVersion = 0x0601; 
    and then i could read Access 2000 mdb, 
    Your project config must be set to shared dll 
    Insert into the initinstance of your myprojapp.h file as 
    shown below 
    [ccode] 
    #ifdef _AFXDLL 
    Enable3dControls(); // Call this when using MFC in a shared DLL 
    AfxGetModuleState()->m_dwVersion = 0x0601; 
    #else 
    Enable3dControlsStatic(); // Call this when linking to MFC statically' 
    #endif 
    [/ccode] 
    Hope that helps 
    Submitted By: gatman (2001/06/08)