急~~急~~急~~我怎么连接不上ACCESS 啊,总报错,帮忙看看 con->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=asmv.mdb","","",adModeUnknown);这样写对吧他告诉我打不开asmv.mdb文件,肯定是在一个目录下的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 try it1con->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=asmv.mdb","","",adConnectUnspecified); 看看你的mdb文件在调试模式下的目录吗?或者写上绝对路径试试? Dubeg目录下和工程目录下都有啊 try { // 打开本地Access库asmv.mdb con->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\Project\\Debug\\asmv.mdb","","",adModeUnknown); } catch(_com_error e) { AfxMessageBox("数据库连接失败,确认数据库asmv.mdb是否在当前路径下!"); return FALSE; } 数据库连接失败,确认数据库asmv.mdb是否在当前路径下 _ConnectionPtr con(__uuidof(Connection));_RecordsetPtr rst(__uuidof(Recordset));try { // 打开本地Access库asmv.mdb con->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\Project\\Debug\\asmv.mdb","","",adModeUnknown); } catch(_com_error e) { AfxMessageBox("数据库连接失败,确认数据库asmv.mdb是否在当前路径下!"); return FALSE; } 就报错了 Debug it!!watch the (_com_error) e.errorcode!!!or try it:adModeUnknown-->adConnectUnspecified _com_error e; e.Description(); what is e.Description()? _com_error::Description,_com_error::ErrorMessage 都是 -1 con.CreateInstance(__uuidof(Connection)); try { // 打开本地Access库asmv.mdb con->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\Project\\Debug\\asmv.mdb","","",adConnectUnspecified); } catch(_com_error e) { AfxMessageBox(_bstr_t(_com_error::Description)); AfxMessageBox(_bstr_t(_com_error::ErrorMessage)); AfxMessageBox("数据库连接失败,确认数据库asmv.mdb是否在当前路径下!"); return FALSE; } 帮忙看看 AfxMessageBox(_bstr_t(e.Description())); or you can set a break point in catch(_com_error e)and see the m_hresult value of e, and list it in here! I have pass it, like that: CoInitialize(NULL); _ConnectionPtr con; con.CreateInstance(__uuidof(Connection)); try { con->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\\asmv.mdb","","",adConnectUnspecified); } catch(_com_error e) {AfxMessageBox(_bstr_t(e.Description())); } CoUninitialize(); it maybe con is null, you not CoInitialize(NULL) and CoUninitialize(). 如果Access版本较早的话,用OLEDB 4.0打不开,如果你的access是97版的,那么可以用 OLEDB 3.5试试 我通过了,SQL 语句这么写对吗?rst->Open("SELECT * FROM II类标准 where 轻型车=false", con.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText);这句话哪错了啊 u盘修里面文件不见了显示的内存变小了 改 dll的函数地址 关于使用CAchive类<<,>>写文件的问题 文件输出的问题 菜鸟提问:用钩子获取所有线程键盘消息的问题 请问这种tree怎么做出来的 请教高手,服务安装的问题 一个关于界面的问题 菜鸟问题:我建立一个工程后,用ClassWizard增加了一个类,它的基类是CTreeView,当我编译的时候出现错误,提示我的基类是不明确的,这是为什么 双网卡网络编程互相通信,如果强制数据包经过网卡? 串口如何发文件? HDC与CDC的转换
con->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=asmv.mdb","","",adConnectUnspecified);
{
// 打开本地Access库asmv.mdb
con->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\Project\\Debug\\asmv.mdb","","",adModeUnknown);
}
catch(_com_error e)
{
AfxMessageBox("数据库连接失败,确认数据库asmv.mdb是否在当前路径下!");
return FALSE;
}
_RecordsetPtr rst(__uuidof(Recordset));try
{
// 打开本地Access库asmv.mdb
con->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\Project\\Debug\\asmv.mdb","","",adModeUnknown);
}
catch(_com_error e)
{
AfxMessageBox("数据库连接失败,确认数据库asmv.mdb是否在当前路径下!");
return FALSE;
}
就报错了
watch the (_com_error) e.errorcode!!!or try it:
adModeUnknown-->adConnectUnspecified
e.Description();
try
{
// 打开本地Access库asmv.mdb
con->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\Project\\Debug\\asmv.mdb","","",adConnectUnspecified);
}
catch(_com_error e)
{
AfxMessageBox(_bstr_t(_com_error::Description));
AfxMessageBox(_bstr_t(_com_error::ErrorMessage));
AfxMessageBox("数据库连接失败,确认数据库asmv.mdb是否在当前路径下!");
return FALSE;
} 帮忙看看
and see the m_hresult value of e, and list it in here!
CoInitialize(NULL);
_ConnectionPtr con;
con.CreateInstance(__uuidof(Connection));
try
{
con->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\\asmv.mdb","","",adConnectUnspecified);
}
catch(_com_error e)
{
AfxMessageBox(_bstr_t(e.Description()));
}
CoUninitialize();
SQL 语句这么写对吗?rst->Open("SELECT * FROM II类标准 where 轻型车=false",
con.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
这句话哪错了啊