vc数据库连接错误
::CoInitialize(NULL); try
{
m_pConnection.CreateInstance("ADODB.Connection");
_bstr_t strConnect = "Provider=SQLOLEDB.1;UID=sa;PWD=sa;database=AdoTest_Data;";
m_pConnection->Open(strConnect,"","",adModeUnknown);
if(m_pConnection->State == adStateOpen)
MessageBox("连接数据库");
m_pConnection->Close();
if(m_pConnection->State == adStateClosed)
MessageBox("断开连接");
}
catch(_com_error e)
{
AfxMessageBox(e.ErrorMessage());
}
运行后显示 IDispatch error#3129 错误, 又知道的大侠指点几句, 谢谢了