C # Querying Oracle stored procedures through OLE DB

Source: Internet
Author: User
Tags ole

Using system;using system.data;using System.Data.OleDb;

  

        <summary>///query Oracle stored procedures via OLE///</summary>//<param name= "id" >&            lt;/param>//<returns></returns> public static DataTable gettodolist (string id) { String connString1 = "PROVIDER=ORAOLEDB.ORACLE.1; User id=test; Password=test;data source= (DESCRIPTION = (address_list= (ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521)) (CONN Ect_data = (service_name = ORCL)); Persist Security info=true; Extended properties= ' plsqlrset=1 ';            /' Plsqlrset=1 ' is important DataSet ds = new DataSet ();            DataTable dt = new DataTable ();            OleDbConnection conn = new OleDbConnection (CONNSTRING1);            OleDbCommand cmd = new OleDbCommand ("Gettodolist", conn);            Cmd.commandtype = CommandType.StoredProcedure; try {Conn.                Open (); Oledbparameter[] parms = {New OleDbParameter ("ID1", OLE DBType.                VarChar)}; Parms[0].                Value = ID; Parms[0].                Direction = ParameterDirection.Input; foreach (OleDbParameter parm in parms) {cmd.                Parameters.Add (Parm);                } OleDbDataAdapter ODA = new OleDbDataAdapter (cmd); Oda.            Fill (DS); } catch (Exception ex) {} finally {cmd.                Dispose (); Conn.            Close (); } return DS.        Tables[0]; }

  

C # Querying Oracle stored procedures through OLE DB

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.