ado连接SQL2000:-----未指定的错误
帮忙看一下这段代码
CString strConn;
HRESULT hr;
try
{
hr=m_pConn.CreateInstance(__uuidof(Connection));
m_pConn->CursorLocation=adUseClient;
strConn="Provider=SQLOLEDB.1;Persist Security Info=False;uid=hy; pwd=hy;Initial Catalog=JXIMS; Data Source=(local)";
if(SUCCEEDED(hr))
{
hr=m_pConn->Open(_bstr_t(strConn),"","",-1); //-1是什么意思???
}
}
catch(_com_error &e)///捕捉异常
{
CString errormessage;
errormessage.Format("连接数据库失败!\r\n错误信息:%s",e.ErrorMessage());
AfxMessageBox(errormessage);///显示错误信息
return FALSE;
}
我完全按书上写的,SQL2000服务器也开着,为什么总说"未指定的错误呢???"我是新手,求大家指教,在线等