vc++通过ADO连接excel连接不上
m_pConnection.CreateInstance(__uuidof(Connection)); try { m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=I:\\demo.xls;Extended Properties=Excel 8.0;HDR=Yes;IMEX=0","","",adModeUnknown);// } catch(_com_error e) { AfxMessageBox(_T("数据库连接失败")); return FALSE; }catch(_com_error& e) { ASSERT(FALSE); CString str; str.Format("文件名称: %s \n 所在代码行 : %d 执行SQL语句失败 错误原因 %s" , __FILE__ , __LINE__ , (LPCSTR)e.Description()); TRACE(str); AfxMessageBox(str); AfxGetMainWnd()->PostMessage(WM_CLOSE); }