Your search did not match any results.
This tutorial gets you started writing .NET code for Oracle Database while taking advantage of integrated Visual Studio tools. You'll use Oracle Data Provider for .NET (ODP.NET) and Oracle Developer Tools for Visual Studio (ODT). Follow these easy steps to get started:
What you'll need
Build some code
In Visual Studio, create a new Visual C# "Console App (.NET Framework)".
Extract this example code zip file into a temporary directory. Find and open the file "Code_Snippet.txt".
Paste the code from "Code_Snippet.txt" into the Main() method
Modify the code:
Add "using Oracle.Managed.DataAccess.Client" to the top of the main .cs (Program.cs) file.
Modify the connect string to use your database's username, password, host name/IP address, database service name, and port number, for example: "User Id=myusername; password=mypass; Data Source=myhost:1521/orclpdb.mycompany.com;"
This sample code uses the HR.EMPLOYEES table. If you do not have the HR schema in your database, modify the tables and columns in the code to use a table that you do have access to.
Build and run the application.
Download and Install Oracle Developer Tools for Visual Studio
Oracle Developer Tools for Visual Studio is required to enable Visual Studio data features such as Server Explorer integration, TableAdapter Configuration Wizard and Entity Designer. It also adds useful Oracle specific features. Visual Studio 2017 Community Edition is currently not supported with Oracle Developer Tools. We will support it in our next release!
Download the ODTwithODAC software bundle into a temporary directory:
Unzip the package and run setup.exe. During the installation please note the following important details:
Close any running instances of Visual Studio before installing
If you already have Oracle software installed, install into a new "Oracle Home" software location (eg. a new subdirectory)
Choose to install "Product Components" Oracle Data Provider for .NET and Oracle Developer Tools for Visual Studio
When prompted, do NOT choose to install Oracle Data Provider for .NET on a "Machine Wide Level".
Connect to Oracle Database from Visual Studio
Right click on Server Explorer's root node and choose "Create New Connection"
In the connection dialog, click the "Change" button to change the data source
Select "Oracle Database" from list of datasources, and "ODP.NET, Managed Driver" from the drop down list. (If you do not see it, it means the installation of Oracle Developer Tools for Visual Studio was not successful. Do NOT select ".NET Framework Data Provider for Oracle").
You will now see Oracle's connection dialog:
Enter the username and password
In the connection type drop down, choose "EZ Connect"
Enter the host/IP, port, and service name for the database you wish to connect to.
Press OK to connect.
You can now explore your Oracle Database in Server Explorer and take advantage of many of the Oracle Developer Tools for Visual Studio features.