用ADO连接数据库发生错误 弹出MessageBox 
数据库是C盘下的  C:\hotel.mdb    用户 密码是对的,用别的数据库软件可以打开,分别是 admin jcecc 
代码如下     try                 
    {    
m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\hotel.mdb",
                    "admin","jcecc",adModeUnknown);
    }
    catch(_com_error e)
    {
        AfxMessageBox("数据库连接失败!");
        return FALSE;
    } 
如果连接C盘下的另一个数据库没有报错! ....Source=C:\\Demo.mdb ","","",...

解决方案 »

  1.   

    怎么查看?我在catch(_com_error e)处设置断开 调试运行! 但是还运行到catch(_com_error e)处 就弹出MessageBox
      

  2.   

    打印 _com_error ecatch(_com_error e)
     { CString Error = e.ErrorMessage(); 
    AfxMessageBox... 
      

  3.   

    这个!  IDispatch error #3149
      

  4.   

    catch(_com_error* e) 
    { CString Error = e->ErrorMessage(); 
    AfxMessageBox... 
    这样打印试试呢
      

  5.   

    没有MessageBox啦 
    但是出现下面问题!  数据库打开啦没?
    Runtime Error!Program: ...ettings\Administrator\桌面\ADO数据库\Debug\ADO数据库.exe
    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.
      

  6.   

        try                 
        {    
            m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\hotel.mdb",
                        "admin","jcecc",adModeUnknown);
        }
        catch(_com_error& e)
        {
            AfxMessageBox( e.Description() );
            return FALSE;
        } 看看错误信息。
      

  7.   

    错误信息是这个
    IDispatch error #3149