17,086
社区成员
发帖
与我相关
我的任务
分享
char ConnBuf[200];
memset(ConnBuf,0,200);
_bstr_t strMissing(L"");
sprintf(ConnBuf,"Provider=OraOLEDB.Oracle.1;Password=%s;Persist Security Info=True;User ID=%s;Data Source=%s",pwd,usr,db);
try
{
cn->Open(ConnBuf, strMissing, "",adConnectUnspecified);
}
catch (_com_error &e)
{
CString errormessage;
errormessage.Format("数据库连接失败!\r\n错误信息:%s,%s", e.ErrorMessage(),(LPCSTR)e.Description());
AfxMessageBox(errormessage);
return -1;
}