在vc中用ADO怎么连接到ORACLE8 ?最好要不要建数据源的方式

解决方案 »

  1.   

    在vc中用ADO怎么连接到ORACLE8.1.6?最好要不要建数据源的方式
      

  2.   

    http://expert.csdn.net/Expert/FAQ/FAQ_Index.asp?id=5949
      

  3.   

    HRESULT hr;
    try
    {
    hr = m_pConnection.CreateInstance("ADODB.Connection");///创建Connection对象
    if(SUCCEEDED(hr))
    {
    LPCSTR strConnect=_T("Provider=ORAOLEDB.ORACLE;Server=(local);Database=MYDBNAME; user id=USERID; password=USERPWD");
    hr = m_pConnection->Open((_bstr_t)strConnect,"","",adModeUnknown);
    }
    }
    catch(_com_error e)///捕捉异常
    {
    CString errormessage;
    errormessage.Format("Database connection error!\r\nInformation:%s",e.ErrorMessage());
    AfxMessageBox(errormessage);///显示错误信息
    }