一般有什么方式?
各位给我写几句代码,好不?
多谢!

解决方案 »

  1.   

    oConn.Open "Driver={Microsoft ODBC for Oracle};" & _
              "Server=OracleServer.world;" & _
              "Uid=myUsername;" & _
              "Pwd=myPassword;"
      

  2.   

    用ADO很方便,客户机要装oracle客户端
      

  3.   


    //--------ADO连接--------------------------
        _ConnectionPtr  pCnn   = NULL;
    pCnn.CreateInstance(__uuidof(Connection)));

    if (pCnn->GetState()==1){
    pCnn->Close();  
    }
    pCnn->Open (strCnn, "", "", adConnectUnspecified);
      

  4.   

    给一个连接字符串的参考,其实你可以在对话框上加一个ado控件,用向导生成连接串
    "Provider=OraOLEDB.Oracle.1;Persist Security Info=False;Data Source=oracle"
    头文件中
    #import "C:\Program Files\Common Files\System\ADO\msado15.dll" \
        no_namespace rename("EOF", "EndOfFile")
      

  5.   

    #import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
    no_namespace rename("EOF", "EndOfFile")#include <stdio.h>void main(void)
    {
       CoInitialize(NULL);
       try 
       {
          _ConnectionPtr pConn("ADODB.Connection");
          _RecordsetPtr  pRst("ADODB.Recordset");      pConn->Open("Provider=sqloledb;Data Source=MyServer;"
             "Initial Catalog=pubs;User Id=sa;Password=;", 
             "", "", adConnectUnspecified);
    // Note 1.
          pRst->Open(
             "authors",
             _variant_t((IDispatch *) pConn, true),
             adOpenStatic,
             adLockReadOnly,
             adCmdTable);
          pRst->MoveLast();
    // Note 2.
          printf("Last name is '%s %s'\n", 
                (char*) ((_bstr_t) pRst->GetFields()->GetItem("au_fname")->GetValue()),
                (char*) ((_bstr_t) pRst->Fields->Item["au_lname"]->Value));      pRst->Close();
          pConn->Close();
       }
       catch (_com_error &e)
       {
          printf("Description = '%s'\n", (char*) e.Description());
       }   
    ::CoUninitialize();
    }
    //------------------------------------------------
    这是一个ado的例子,在msdn中索引Visual C++ ADO Programming
    你改一下连接串就可以了,注意用户名和密码