偶的下列代码在装有VC环境下运行良好(程序采用静态库连接),但在无VC环境的机器上却提示错误断点:daocore.cpp第534行.
代码如下:
   CDaoDatabase db;
  db.Create("c:\\dtt.mdb");
  db.Close();
就是在无VC环境的机器上装上msdac2.8都不行啊,到底是哪里错了啊

解决方案 »

  1.   

    动态创建ACCESS数据库
    stdafx.h 文件中:
    #import "c:\Program files\Common files\system\ado\msadox.dll" no_namespace  创建文件代码:
    HRESULT hr = S_OK;  
     
    CoInitialize(NULL);
    //  Define  ADOX  object  pointers.  
    //  Initialize  pointers  on  define.  
    //  These  are  in  the  ADOX::    namespace.  
             
    _CatalogPtr m_pCatalog = NULL;  
     
    //Set  ActiveConnection  of  Catalog  to  this  string  
    _bstr_t strcnn("Provider='Microsoft.Jet.OLEDB.4.0';Data source = c:\\tanyizhi.mdb");  
    try  
    {  
    hr = m_pCatalog.CreateInstance(__uuidof(Catalog));  
            m_pCatalog->Create(strcnn);  
            AfxMessageBox("Database 'c:\\tanyizhi.mdb' is created.\n");  
    }  
    catch(_com_error &e)  
    {  
            //  Notify  the  user  of  errors  if  any.  
    _bstr_t  bstrSource(e.Source());  
            _bstr_t  bstrDescription(e.Description());  
            AfxMessageBox((LPCSTR)bstrSource);
    AfxMessageBox((LPCSTR)bstrDescription);  
    }  
    catch(...)  
    {  
    AfxMessageBox("error");  
    }
    CoUninitialize();
      

  2.   

    http://blog.csdn.net/laiyiling/archive/2004/10/23/148112.aspx
      

  3.   

    用Dependence看一下缺了什么库没有
      

  4.   

    呵呵,建议用ADO而不是DAO,如第二楼
      

  5.   

    偶同时用了#import "c:\program files\common files\system\ado\msado20.tlb"
    和#import "c:\Program files\Common files\system\ado\msadox.dll" no_namespace 里面提到了结构和接口函数重复定义但又都要用到它们的智能指针,怎么办呀
      

  6.   

    偶以前很多地方用的是ADO未命名空间,照二楼提供的方法ADO使用重命名不是每个用ADO的地方都用ADO命名空间,那多麻烦啊,还有没有其他方法啊
      

  7.   

    只要这句试试
    #import "c:\program files\common files\system\ado\msado20.tlb"