locked
oracle - how to connect RRS feed

  • Question

  • i have an exercise that write an application that interact to oracle DB. i know c# language and used to work with MS SQL. can you tell me how to connect to oracle server and what are differences of oracle and MS SQL. thanks.
    mtd
    Saturday, May 23, 2009 3:16 PM

Answers

  • I dont think the difference between oracle and ms sql is in scope of this forum.

    Connecting to oracle

    const string strConn = "Provider=MSDAORA.1;Data Source=oracle_db;User ID=scott;Password=tiger";
    const string strSQL = "Select * From EMP";
    try {
    DataSet ds = new DataSet("EmployeesSet");
    ADODataSetCommand myCommand = new ADODataSetCommand(strSQL,strConn);
    myCommand.FillDataSet(ds,"Buyer");
    Console.WriteLine(ds.Xml);
    }
    catch (ADOException e) {
    Console.WriteLine("Exception Occured :{0}",e.Errors[0].Message);
    }




    Thanks,
    A.m.a.L
    .Net Goodies
    Remember to click "mark as answered" when you get a correct reply to your question
    • Marked as answer by middlecowboy Saturday, May 23, 2009 6:30 PM
    Saturday, May 23, 2009 4:24 PM

All replies

  • I dont think the difference between oracle and ms sql is in scope of this forum.

    Connecting to oracle

    const string strConn = "Provider=MSDAORA.1;Data Source=oracle_db;User ID=scott;Password=tiger";
    const string strSQL = "Select * From EMP";
    try {
    DataSet ds = new DataSet("EmployeesSet");
    ADODataSetCommand myCommand = new ADODataSetCommand(strSQL,strConn);
    myCommand.FillDataSet(ds,"Buyer");
    Console.WriteLine(ds.Xml);
    }
    catch (ADOException e) {
    Console.WriteLine("Exception Occured :{0}",e.Errors[0].Message);
    }




    Thanks,
    A.m.a.L
    .Net Goodies
    Remember to click "mark as answered" when you get a correct reply to your question
    • Marked as answer by middlecowboy Saturday, May 23, 2009 6:30 PM
    Saturday, May 23, 2009 4:24 PM
  • I would use the Oracle data provider which can be found here .

    Then to use it, see here

    John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com
    Saturday, May 23, 2009 4:32 PM
  • You can make use of the Oracle Client. It might not appear by default and you have to add reference to System.Data.OracleClient dll to access it
    Ganesh Ranganathan
    [Please mark the post as answer if you find it helpful]
    • Proposed as answer by kmmohd_anwar Sunday, May 24, 2009 7:40 AM
    Saturday, May 23, 2009 8:32 PM