Results 1 to 7 of 7

Thread: Connection to Oracle in .Net Framework 1.0

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    81

    Question Connection to Oracle in .Net Framework 1.0

    Hi........

    I've .Net Framework 1.0 and I want to connect Oracle 8i.

    Can I do this in .Net Framework 1.0 ?
    ( System.Data.Odbc ) namespace does not exist in this version.

    plz tell me how can I do it.......it would be more helpful if u post some code here.

    Thanks,
    Manoj

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    81

    Re: Connection to Oracle in .Net Framework 1.0

    huh...

    I resolved it and I'm posting my code here for reference.......


    //Connection with Oracle.

    OleDbConnection Conn = new OleDbConnection() ;
    OleDbDataAdapter DA ;
    DataTable DT ;

    Conn.ConnectionString = @"Provider=MSDAORA.1;Password=tiger;User ID=scott;Data Source=MANOJ" ;
    Conn.Open() ;

    DA = new OleDbDataAdapter("Select * From Emp", Conn ) ;
    DT = new DataTable() ;
    DA.Fill(DT) ;
    dataGrid1.DataSource = DT ;



    //Connection to MS Access.
    OleDbConnection Conn ;
    OleDbDataAdapter DA ;
    DataTable DT ;

    Conn = new OleDbConnection() ;
    Conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Manoj\MyDatabase.mdb" ;
    Conn.Open() ;
    DA = new OleDbDataAdapter("Select * From EmpInfo", Conn ) ;

    DT = new DataTable() ;
    DA.Fill(DT) ;
    dataGrid1.DataSource = DT ;



    Thanks & Regards
    Manoj

  3. #3
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Connection to Oracle in .Net Framework 1.0

    Wht connect though ODBC it's more costly then using the direct method.
    ?
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Connection to Oracle in .Net Framework 1.0

    You can download ADO.NET components from Oracle, although it does not mention 8i. I'd download the 9i version and see if that works. The Oracle-specific components will be more efficient and possibly more functional than the more general OleDb.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    New Member
    Join Date
    Apr 2006
    Posts
    2

    Re: Connection to Oracle in .Net Framework 1.0

    using System.Data.OracleClient;
    (reference:
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.OracleClient.dll
    from Microsoft site, I believe)

    If you don't have the reference, I will be glad to send it.

    string Hdrstr = "SERVER=SERVERNAME;UId=MYUSERID;Pwd=thepassword";
    OracleConnection HdrConn = new OracleConnection(Hdrstr);
    HdrConn.Open();
    OracleCommand HdrCmd = HdrConn.CreateCommand();
    HdrCmd.CommandText = "SELECT H.RID, H.DATE " +
    " FROM JOURNAL_ENTRY H " +
    " WHERE H.DATE BETWEEN '" + txtFromDate.Text + "' and '" + txtToDate.Text +
    "' ORDER BY H.DATE";
    OracleDataReader HdrReader = HdrCmd.ExecuteReader();

    The Oracle commands are essentially the same as the OleDb commands.

    I am using this on Oracle 8i. It works fairly quickly considering the speed of the machine I'm using.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Connection to Oracle in .Net Framework 1.0

    That's not possible in version 1.0 of the Framework tablazon, as the System.Data.OracleClient namespace wasn't added until version 1.1.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7
    New Member
    Join Date
    Apr 2006
    Posts
    2

    Re: Connection to Oracle in .Net Framework 1.0

    Yes, you're right!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width