1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

source code for connecting oracleClient(oleDb) with visual studio in c#

Discussion in 'Other Development Tools' started by sadiyarani, Mar 16, 2009.

  1. sadiyarani

    sadiyarani Active Member

    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    55
    what is the source code for connecting oracleClient(oleDb) with visual studio in c#.
     
  2. sameer

    sameer Forum Advisor

    Messages:
    105
    Likes Received:
    6
    Trophy Points:
    240
    I used to connect with Oracle 9i on Visual Studio 2005 with C# with the code below. Take a look if it helps you out.

    //Connect to an Oracle Database using the OLEDB Provider
    Code (Text):

    using System.Data;
    using System.OleDb;

    OleDbConnection oConnection = new OleDbConnection(("Provider=MSDAORA.1;UserID=scott;password=tiger; database=dbname");

    try
    {
    oConnection.Open();
    OleDbCommand oCommand = new OleDbCommand("Select * From Table", oConnection);
    DataTable oTable = new DataTable();
    OledbDataAdapter oAdapter = new OleDbDataAdapter(oCommand);
    oAdapter.Fill(oTable);

    }
    catch(OleDbException caught)
    {MessageBox.Show(caught.message);}
    finally
    {
    oConnection.Close();
    }