Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 16th, 2006, 09:06 AM
Authorized User
 
Join Date: Jan 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default oracle connection

hello everybody. thanks in advance for your help.

i'm doing a connection to an oracle database with visual c#.
I now my programs must have a look like this:

public void ConnectToOracle()
{
    OracleClient.OracleConnection conn =
        new OracleClient.OracleConnection ();
    // TODO: Modify the connection string and include any
    // additional required properties for your database.
    conn.ConnectionString = "Data Source=" +
        "<oracle data source name>;Integrated Security=yes";
    try
    {
        conn.Open();
        // Insert code to process data.
    }
        catch (Exception ex)
    {
        MessageBox.Show("Failed to connect to data source");
    }
    finally
    {
        conn.Close();
    }
}

my problem is how can i access to the class "oracleconnection". it belongs to:

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Data.OracleClient.OracleConnection

but i don't know how to add this namespaces or classes. any help will be really apreciated. thanks.

                                   silvi

 
Old January 16th, 2006, 10:04 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You'll need an assembly reference to the assembly that contains that class. For the oracle client it's the System.Data.OracleClient.dll assembly of the framework.

-Peter
 
Old January 17th, 2006, 05:29 AM
Authorized User
 
Join Date: Jan 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Could you please explain me how to do that? this is the first time i work with C# and I'm not familiarized with it. Thanks a lot.

                                      silvi

 
Old January 17th, 2006, 05:53 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nalla Send a message via Yahoo to nalla
Default


Hi silvia,

In your solution explorer right click on References-->Add Reference. Select System.Data.OracleClient.dll in .Net tab and then press ok. Then make sure you'll see System.Data.OracleClient.dll has added to your References.



nalaka hewage
 
Old January 17th, 2006, 08:12 AM
Authorized User
 
Join Date: Jan 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks to everybody who answered. I think it works now. I was going mad with something so simple.

                             silvi






Similar Threads
Thread Thread Starter Forum Replies Last Post
Oracle connection issue. rupen ASP.NET 2.0 Professional 2 March 11th, 2009 02:26 AM
Oracle Connection teddyk ASP.NET 2.0 Basics 1 October 6th, 2008 06:08 PM
Oracle Database Connection jmss66 Classic ASP Databases 2 October 18th, 2006 03:13 PM
connection to oracle thru jdbc venkitaraman Java Databases 5 April 6th, 2005 06:05 AM
oracle connection string pankaj_daga Oracle 2 July 12th, 2004 03:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.