Connect Oracle to read data

Source: Internet
Author: User
Tags oracleconnection

Not how to use Oracle, and is in the local government rent intranet internal estimate is the cause of the firewall is not even in the virtual machine Oracle, just start a lot of trouble to find problems, and now give up the use of direct database, write down to use it

    Public classLoadData {/// <summary>        ///         /// </summary>        /// <returns></returns>         Public Static stringGetcunliangfang (stringIdno) {            stringOraclepath = Application.startuppath +@"\lib"; Environment.setenvironmentvariable ("PATH", Oraclepath, environmentvariabletarget.process); Environment.setenvironmentvariable ("Nls_lang","simplified Chinese_china. ZHS16GBK", environmentvariabletarget.process); stringRTN =string.            Empty; //string connstring = "PROVIDER=ORAOLEDB.ORACLE.1; User Id=tax; Password=tax;data source= (DESCRIPTION = (address_list= (ADDRESS = (PROTOCOL = TCP) (HOST = * * * *) (PORT = * * * *))) (Connect_d ATA = (service_name = ORCL))) ";            stringConnString ="Persist Security info=true; User Id=tax; Password=tax; Unicode=true;data source= (DESCRIPTION = (Address_list = (ADDRESS = (PROTOCOL = TCP) (HOST =140.28.21.14) (PORT = 1521)) ( Connect_data = (service_name = ORCL));"; OracleConnection Conn=NewOracleConnection (connstring); Conn.            Open (); stringsql =string. Format ("SELECT * from Fdcjy_jyfcxx_hz", Idno);//WHERE id_sno= ' {0} 'OracleCommand cmd =NewOracleCommand (SQL, conn); OracleDataReader Dr=cmd.            ExecuteReader (); if(Dr. Read ()) {ArrayList arr=NewArrayList (); Arr. ADD (dr["OC_CQRZJLX"]);//Seller Document Type codeArr. ADD (dr["OC_CQRLXDH"]);//Contact PhoneArr. ADD (dr["Oc_cqrgj"]);//Seller Nationality CodeArr. ADD (dr["Oc_cqrlxdz"]);//Seller Addressarr. ADD (dr["OC_MFXM"]);//"Buyer's nameArr. ADD (dr["OC_MFZJLX"]);//"Buyer's document typeArr. ADD (dr["OC_MFZJHM"]);//ID NumberArr. ADD (dr["Oc_mfgj"]);//Nationality CodeArr. ADD (dr["OC_MFLXDH"]);//Contact PhoneArr. ADD (dr["Oc_mflxdz"]);//Contact Address//Housing InformationArr. ADD (dr["DT_HTQDRQ"]. ToString ());//date of contract signingArr. ADD (dr["Oc_qxdm"]);//Administrative DivisionsArr. ADD (dr["Oc_jdxz"]);//Street TownshipArr. ADD (dr["Oc_fwzl"]);//the place where the house belongs, has the defaultArr. ADD (dr["Oc_fczh"]);//House Deed No.Arr. ADD (dr["Oc_htzj"]. ToString ());//Contract AmountArr. ADD (dr["OC_FCLX"]);//Property TypeArr. ADD (dr["Oc_fczh"]);//House Building NumberArr. ADD (dr["OC_SZLC"]);//FloorArr. ADD (dr["OC_SCJYFS"]);//last access to housing                ////arr. ADD (dr["OC_HTZJ"]);//Trading Price--Temporary useArr. ADD (dr["DT_SCJYSJ"]. ToString ());//Last Trading TimeArr. ADD (dr["OC_FWTC"]);//Last home Acquisition costArr. ADD (dr["OC_JYLX"]);//type of transactionArr. ADD (dr["OC_BZ"]);//NotesRTN =string. Join (",", (string[]) arr. ToArray (typeof(string))); } conn.            Close (); Cmd.            Dispose (); returnRtn; }    }

Connect Oracle to read 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.