HRESULT hr;
::CoInitialize(NULL);
m_pConnection = NULL;
m_sConnection = _T("");
try
{
hr = m_pConnection.CreateInstance("ADODB.Connection");
///创建Connection对象
if (SUCCEEDED(hr))
{
m_pConnection->ConnectionTimeout = 3;
///set the timeout 3 seconds,
hr = m_pConnection->Open(_bstr_t((LPCTSTR)m_sConnection), _bstr_t(L""), _bstr_t(L""), ADODB::adOpenUnspecified);
}
}
catch (_com_error e)///捕捉异常
{
CString temp;
temp.Format("连接数据库错误信息:%s", e.ErrorMessage());
::MessageBox(NULL, temp, "提示信息", NULL);
}
执行完m_pConnection.CreateInstance("ADODB.Connection");这句后,也不跳到异常部分,也不执行下一步,也不报错. VS2013下面就是提示就绪
------解决思路----------------------
sqlite设计的这么简单的数据库 为什么要用ado这么复杂的接口去操作呢
