我用VS2005连接SQL2000数据库时为什么报错,抛出错误是idispatch #error 3105
AfxOleInit();
_bstr_t str = "Data Source=A;Initial Catalog=ws;Integrated Security=True"; m_pConnection.CreateInstance(__uuidof(Connection));
try
{
m_pConnection->Open(str,"sa","",adModeUnknown); }
catch(_com_error e)
{
CString errormessage;
errormessage.Format(_T("连接数据库失败!\r\n错误信息:%s"),e.ErrorMessage());
AfxMessageBox(errormessage);///显示错误信息
return FALSE;
}还问一下idispatch #error 3105这个错误是什么原因引起的?
AfxOleInit();
_bstr_t str = "Data Source=A;Initial Catalog=ws;Integrated Security=True"; m_pConnection.CreateInstance(__uuidof(Connection));
try
{
m_pConnection->Open(str,"sa","",adModeUnknown); }
catch(_com_error e)
{
CString errormessage;
errormessage.Format(_T("连接数据库失败!\r\n错误信息:%s"),e.ErrorMessage());
AfxMessageBox(errormessage);///显示错误信息
return FALSE;
}还问一下idispatch #error 3105这个错误是什么原因引起的?
// A为服务器地址或名称; ws为DB的名称:
_bstr_t str = "Provider=SQLOLEDB;Data Source=A;Initial Catalog=ws;Integrated Security=True"; // sa 没密码吗?
m_pConnection->Open(str,"sa","",adConnectUnspecified);
{
AfxMessageBox( e.Description() );
}
看看有什么错误