Oracle database of ADO

Source: Internet
Author: User
Tags oracleconnection

ADO Operation Oracle database is basically the same as the original operation of MSSQL. Just use a different namespace. Here are two examples:

One. C # Read the table for Oracle database

 ///ADO Read Table///you need to add a namespace: Using System.Data.OracleClient//Link String stringConnString =@"User Id=system; Password=123456;data source= (DESCRIPTION = (address_list= (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1 .118) (PORT = 1521))) (Connect_data = (service_name = ORCL) ))";//Create a linkOracleConnection conn =NewOracleConnection (connstring); Conn. Open (); stringsql ="SELECT * from Help"; OracleDataAdapter Sda_tab=Neworacledataadapter (SQL, conn); DataSet DS=NewDataSet (); Sda_tab. Fill (DS); DataTable TB= ds. tables[0];

Two. C # Executes Oracle statement returns the number of rows affected

 stringConnString =@"User Id=system; Password=123456;data source= (DESCRIPTION = (address_list= (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1 .118) (PORT = 1521))) (Connect_data = (service_name = ORCL) ))";//Create a linkOracleConnection conn =NewOracleConnection (connstring); Conn. Open (); stringsql ="SELECT * from Help"; OracleCommand cmd=NewOracleCommand (SQL, conn);intret = cmd. ExecuteNonQuery ();

Oracle database of ADO

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.