try
{
m_pConnection.CreateInstance("ADODB.Connection"); //创建连接对象实例
// _bstr_t strConnect="DRIVER={Microsoft Access Driver (*.mdb)};\
uid=;pwd=;DBQ=Database.mdb;";
// m_pConnection->Open(strConnect,"","",adModeUnknown); //打开数据 CString str="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db_Video.mdb;Persist Security Info=False";
m_pConnection->ConnectionString=str.AllocSysString();
m_pConnection->Open("","","",-1);
}
catch(_com_error e)
{
AfxMessageBox(e.Description());
}
已经AfxOleInit()初始化库,我都快烦死,连接别的数据库也一样,我是win7,vc++6.0。
调试运行提示Unhandled exception in *.exe 0xC000005:Access Violation 警告。
{
m_pConnection.CreateInstance("ADODB.Connection"); //创建连接对象实例
// _bstr_t strConnect="DRIVER={Microsoft Access Driver (*.mdb)};\
uid=;pwd=;DBQ=Database.mdb;";
// m_pConnection->Open(strConnect,"","",adModeUnknown); //打开数据 CString str="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db_Video.mdb;Persist Security Info=False";
m_pConnection->ConnectionString=str.AllocSysString();
m_pConnection->Open("","","",-1);
}
catch(_com_error e)
{
AfxMessageBox(e.Description());
}
已经AfxOleInit()初始化库,我都快烦死,连接别的数据库也一样,我是win7,vc++6.0。
调试运行提示Unhandled exception in *.exe 0xC000005:Access Violation 警告。
oXE06D7363:Microsoft C++ Exception 错误。
Call Stack: KERNELBASE ! 75a5d36f()中停止
不要看这个调用栈 Call Stack: KERNELBASE ,往下找你程序的代码函数
就可以定位到代码错误了。
m_pConnection->ConnectionString=(_bstr_t)(LPCTSTR)str;