What settings do I need to VS2015 to operate Oracle data?

Source: Internet
Author: User
Tags oracleconnection oracle developer

1 "Download on Oracle network: odp.net

2 Select Download according to your Oracle data 32bit/64bit.

3 "Follow the prompts to configure the Tnsnames.ora file.

# alias = # (DESCRIPTION = # (ADDRESS = (PROTOCOL = TCP) (HOST =localhost) (PORT = 1521)) # (Connect_data = # (SERVER = DEDI cated) # (service_name = ORCL) #) Alias: You can define it casually, such as: ORL; port: The port number when you install Oracle data yourself. SERVICE_NAME: The database instance name created by the installation of Oracle data, such as: ORCL.

4 "Find the downloaded odp.net (Oracle data Providepor for VSXXXX), typically installed in C:\Program Files (x86) \oracle Developer Tools for VS2015, find the ODP. Net Folder and the Odt folder, find OraVSProvCfg.exe in the inside to register.

5 "After the registration, you can carry out a simple application.

Using system;using system.collections.generic;using system.linq;using system.text;using System.Threading.Tasks; The using oracle.dataaccess.client;//references Dllnamespace consoleapplication2{class program {static void Main (string [] args) {string constr = "User Id=leo;            Password=m123;data SOURCE=ORCL ";            OracleConnection con = new OracleConnection (CONSTR); Con.            Open (); Display Version number Console.WriteLine ("Connected to Oracle" + con.            ServerVersion);            OracleCommand CMMD = new OracleCommand ("SELECT * from Leo_person", con);            OracleDataAdapter OA = new OracleDataAdapter (CMMD);            System.Data.DataSet ds = new System.Data.DataSet (); Oa.            Fill (ds, "person"); foreach (System.Data.DataRow row in DS. Tables[0].                Rows) {int count = 0; foreach (System.Data.DataColumn column in DS. Tables[0]. Columns) {CONSOLE.WRite (column.                    ColumnName + ":" + row[column] + "\ t");                count++;                } if (count = = 3) {Console.Write ("\ n"); }}//Close and Dispose oracleconnection con.            Close (); Con.            Dispose (); Console.read ();

  

What settings do I need to VS2015 to operate Oracle data?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.