Runtime Errorthis application requested the Runtime to terminate it in an unusual way
Please contact the Application's support team for more information是什么错误,又应该怎么解决呢?
Please contact the Application's support team for more information是什么错误,又应该怎么解决呢?
void MainDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
if(m_ZuCheng.IsEmpty())
{
AfxMessageBox("请输入");
}
else
{
try
{
m_pRecordset->Open("select * from YaoFan",
theApp.m_pConnection.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
m_pRecordset->Close();
m_pRecordset = NULL;
}
catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
}
}
CDialog::OnOK();
}我把m_pRecordset->Open("select * from YaoFan",
theApp.m_pConnection.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
m_pRecordset->Close();
m_pRecordset = NULL;
去掉就不会有错误
能告诉我为什么吗?
在控制面板--管理工具--ODBC数据源里面配
AfxOleInit();
m_pConnection.CreateInstance(__uuidof(Connection));
try
{
// 打开本地Access库Yao.mdb
m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Yao.mdb","","",adModeUnknown);
}
catch(_com_error e)
{
AfxMessageBox("数据库连接失败,确认数据库Yao.mdb是否在当前路径下!");
return false;
}
我用的是#import "c:\program files\common files\system\ado\msado15.dll" \
no_namespace \
rename ("EOF", "adoEOF") rename("BOF","adoBOF")
这种方法来连接的啊
不知道为什么
请高手指点一下吧