用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 ","","",...
数据库是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 ","","",...
{ CString Error = e.ErrorMessage();
AfxMessageBox...
{ CString Error = e->ErrorMessage();
AfxMessageBox...
这样打印试试呢
但是出现下面问题! 数据库打开啦没?
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.
{
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;
} 看看错误信息。
IDispatch error #3149