没用过vc,
是不是应该用ado?

解决方案 »

  1.   

    对呀,用ADO比较方便,当然也可以用其他的,如ODBC,OCI,PROC等。请知道者,尽快答复我。本人在线等待!
      

  2.   

    ?How would the two providers compare and contrast? Is one significatly
    ?better than the other in terms of stability, performance, thread
    ?safety, etc.Oracle's drivers are typically updated to support newer versions of their database software. In the
    past the Microsoft OLEDB Driver (MSDAORA) was more stable, however it is coded against OCI 7.0 and
    will no longer be updated to support newer versions of Oracle.
      

  3.   

    .Connect = "Provider=MSDAORA.1;Password=tiger;User ID=scott;Data Source=CAFGEN"Change this to .Connect = "Provider=ORAOLEDB.Oracle.1;Password=tiger;User ID=scott;Data Source=CAFGEN"MSDAORA and Oracle 9i do not play well together...cannot help with part one but I am sure mlmcc can once you mention the CR version
      

  4.   

    msdaora 提供者是微软,微软本来就在odbc中内置了oracle的驱动程序OraOLEDB.Oracle 提供者oralce,你安装了OraOLEDB_92020.exe和OraWin_92010.exe后在odbc驱动库中就增加了oralce的驱动程序。你能否将这两个了OraOLEDB_92020.exe和OraWin_92010.exe发给我一份my e-mail:[email protected]谢谢
      

  5.   

    Use Oracle9i OraOLEDB Provider In ASP.Net 
    There are lot of examples on how ASP.Net applications are used with SQLServer or MS Access database. But these are not the only databases that are in use in enterprise applications. For one of recent projects for a client we have to connect to connect Oracle9i database for pushing and pulling the data. We had some interesting experiences along the way. So we decided that we will share with rest of the developer community too. What data provider is used for Oracle database?
    You have following choices of data providers for non-MS SQL Server databases. OleDb Data Provider 
    ODBC Data Provider 
    Data Provider for Oracle (Beta 1) 
    Although data provider for Oracle is available for download from Microsoft, but we decided not to use it because it is still in Beta state and we are working on an actual high volume internet application. So the choice was either use ODBC or OleDb data providers. Since an OleDb provider is available for Oracle9i, we decided to use that. Why did not we use microsoft's OleDb provider for Orcale9i? Infact we did try. Believe it or not, we failed to make a simple connection with the database. And on top of that the error information returned was least helpful to figure out what the problem was. Following is the connection string we used. "Provider=MSDAORA;Data Source=R2D2;User ID=foo; Password=bar";

    We did not have any luck with above mentioned connection string. Finally we decided that we will use Oracle Provider for OLE DB (OraOLEDB). When you install Oracle9i, this data provider gets installed along with it. What connection string to use?
    The connection string to connect to Oracle9i is the same as the one that used for Microsoft OLEDB provider for Oracle with only one difference that instead of MSDAORA, you will use OraOLEDB.Oracle as the provider. To connect to an Oracle database using OraOLEDB, the OLE DB connection string must be as follows: "Provider=OraOLEDB.Oracle;Data Source=R2D2;User ID=foo; Password=bar";

    Make sure that you have entry for the data source in tnsnames.ora file and TNSListener service is running. For more information on OraOLEDB provider refer to Orcale9i documentation. How to use it?
    Following is sample code that we used for validating user information for logging into the application. private bool ValidateUser(string strLogin, string strPwd)
    {
    bool bRet = false;
    OleDbConnection conn = null;
    try
    {
    string connString = "Provider=OraOLEDB.Oracle;Data Source=R2D2;User ID=foo;Password=bar";
    conn = new OleDbConnection(connString);
    conn.Open();
    string strQuery = "select * from siteusers where login='" + strLogin + "'";
    OleDbCommand obCmd = new OleDbCommand(strQuery, conn);
    OleDbDataReader obReader = obCmd.ExecuteReader();
    while (obReader.Read())
    {
    string strVal = obReader["password"].ToString();
    if (string.Compare(strVal, strPwd) == 0)
    {
    bRet = true;
    }
    }
    }
    catch (OleDbException ex)
    {
    Response.Write(ex.Message);
    throw ex;
    }
    finally
    {
    if (null != conn)
    {
    conn.Close();
    }
    }
    return bRet;
    }
    以上为ASP.NET连接ORACLE的文章,我觉的对于VC来说,这些都相差不大,因为关键的一点是:我们都使用了ADO去访问ORACLE数据库,上面有详细的说明,楼主可以自己看一下
      

  6.   

    我通常用Oracle提供的驱动,很方便的
      

  7.   

    Use Oracle9i OraOLEDB Provider In ASP.Net 
    There are lot of examples on how ASP.Net applications are used with SQLServer or MS Access database. But these are not the only databases that are in use in enterprise applications. For one of recent projects for a client we have to connect to connect Oracle9i database for pushing and pulling the data. We had some interesting experiences along the way. So we decided that we will share with rest of the developer community too. What data provider is used for Oracle database?
    You have following choices of data providers for non-MS SQL Server databases. OleDb Data Provider 
    ODBC Data Provider 
    Data Provider for Oracle (Beta 1) 
    Although data provider for Oracle is available for download from Microsoft, but we decided not to use it because it is still in Beta state and we are working on an actual high volume internet application. So the choice was either use ODBC or OleDb data providers. Since an OleDb provider is available for Oracle9i, we decided to use that. Why did not we use microsoft's OleDb provider for Orcale9i? Infact we did try. Believe it or not, we failed to make a simple connection with the database. And on top of that the error information returned was least helpful to figure out what the problem was. Following is the connection string we used. "Provider=MSDAORA;Data Source=R2D2;User ID=foo; Password=bar";

    We did not have any luck with above mentioned connection string. Finally we decided that we will use Oracle Provider for OLE DB (OraOLEDB). When you install Oracle9i, this data provider gets installed along with it. What connection string to use?
    The connection string to connect to Oracle9i is the same as the one that used for Microsoft OLEDB provider for Oracle with only one difference that instead of MSDAORA, you will use OraOLEDB.Oracle as the provider. To connect to an Oracle database using OraOLEDB, the OLE DB connection string must be as follows: "Provider=OraOLEDB.Oracle;Data Source=R2D2;User ID=foo; Password=bar";

    Make sure that you have entry for the data source in tnsnames.ora file and TNSListener service is running. For more information on OraOLEDB provider refer to Orcale9i documentation. How to use it?
    Following is sample code that we used for validating user information for logging into the application. private bool ValidateUser(string strLogin, string strPwd)
    {
    bool bRet = false;
    OleDbConnection conn = null;
    try
    {
    string connString = "Provider=OraOLEDB.Oracle;Data Source=R2D2;User ID=foo;Password=bar";
    conn = new OleDbConnection(connString);
    conn.Open();
    string strQuery = "select * from siteusers where login='" + strLogin + "'";
    OleDbCommand obCmd = new OleDbCommand(strQuery, conn);
    OleDbDataReader obReader = obCmd.ExecuteReader();
    while (obReader.Read())
    {
    string strVal = obReader["password"].ToString();
    if (string.Compare(strVal, strPwd) == 0)
    {
    bRet = true;
    }
    }
    }
    catch (OleDbException ex)
    {
    Response.Write(ex.Message);
    throw ex;
    }
    finally
    {
    if (null != conn)
    {
    conn.Close();
    }
    }
    return bRet;
    }
    以上为ASP.NET连接ORACLE的文章,我觉的对于VC来说,这些都相差不大,因为关键的一点是:我们都使用了ADO去访问ORACLE数据库,上面有详细的说明,楼主可以自己看一下
      

  8.   

    to chi_ke:
    这两个文件比较大,发不了的。你可以上oracle网站下载。
      

  9.   

    to sunnyboy6281:
    你是怎么安装驱动的?用什么来安装的?
      

  10.   

    to Drate:
    你好,谢谢你替我找那么多资料,但是你只回答了部分问题,但是你要明白我的其它问题,我并不是不知道怎么用,而是怎样用最简单的方法在一台”干净“的机器上装上oracle oledb的驱动,即”"Provider=OraOLEDB.Oracle...",现在只能用oracle客户端来安装得到,但我嫌这个太大,所以我后来从oracle网站上下载一些for win的驱动,见我的提问,有两个,可是我用它们在一台“干净”的机器上安装之后,却提示错误(见上),这是为什么?
      

  11.   

    adoHRESULT hr;
    try

    hr =m_pADOConnection.CreateInstance("ADODB.Connection");
    if(SUCCEEDED(hr))
    {
    m_pADOConnection->ConnectionTimeout = 15; if (m_pADOConnection->State) m_pADOConnection->Close();
    m_pADOConnection->Open( "Provider=OraOLEDB.Oracle.1;Password=manager;\
    Persist Security Info=True;User ID=system;Data Source=vrdb",
    "",
    "",
    adModeUnknown);
    } m_bNewRecord = FALSE;
      

  12.   

    用ado
    HRESULT hr;
    try
    {

         hr =m_pADOConnection.CreateInstance("ADODB.Connection");
         if(SUCCEEDED(hr))
          {
    m_pADOConnection->ConnectionTimeout = 15;// 连接超时      if (m_pADOConnection->State) m_pADOConnection->Close();
          m_pADOConnection->Open(
                     "Provider=OraOLEDB.Oracle.1;Password=manager;\
    Persist Security Info=True;User ID=system;Data Source=vrdb",
    "",
    "",
    adModeUnknown);
    }
             //记录集
    }