问ado+odbc一函数

zhusunme 2005-04-27 02:52:32
_ConnectionPtr m_pConnection("ADODB.Connection");
m_pConnection->Open("Driver={MySQL ODBC 3.51 Driver};Server=10.214.43.66;Port=3306;Option=3;
DATABASE=zs;UID=zhusun;PWD=123456;","","",adModeUnknown);
请问函数open的参数是什么类型的,比如Server等,要一字符串的形式传参数给他们,要怎样做?
...全文
50 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hxfhxf 2005-04-27
  • 打赏
  • 举报
回复
Open函数的关键参数就是连接字符串,可以根据你连接数据库和机器配置有所不同,把你要连接的数据库和数据库存放位置给出,等别人告诉你
hxfhxf 2005-04-27
  • 打赏
  • 举报
回复
_ConnectionPtr pMyConnect=NULL;
HRESULT hr=pMyConnect.CreateInstance(__uuidof(Connection)));
if(FAILED(hr))return;

_bstr_t strConnect="Provider=SQLOLEDB; Server=server_name;"
"Database=database_name; uid=user_name; pwd=password;"; //连接字符串
//connecting to the database server now:
try{pMyConnect->Open(strConnect,"","",NULL);}
catch (_com_error &e)
{
::MessageBox(NULL,e.Description(),"警告",MB_OK │ MB_ICONWARNING);
}

4,011

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧