使用ADO访问SQL SERVER 出现问题
void ADOConn::OnInitADOConnect()
{
//初始化OLE/COM库环境
::CoInitialize(NULL);
try
{
//创建Connection对象
m_pConnection.CreateInstance("ADODB.Recordset");
//设置连接字符串,必须是bstr型或者_bstr_t类型
_bstr_t strConnect="Provider=SQLOLEDB;Server=ds;Database=HrSys;uid=sa;pwd=6405;";
m_pConnection->Open(strConnect,"","",adModeUnknown);
}
//捕捉异常
catch(_com_error e)
{
AfxMessageBox(e.Description());
}
}
现在不能初始化,老是执行catch语句,
请问是哪错了?