[C # for Oracle operations] C # action Call Orcale stored procedure has parameters

Source: Internet
Author: User
Tags oracleconnection

/// <summary>        ///access to ERP fixed assets for data extraction/// </summary>        /// <param name= "Strcompanycode" >Company Code</param>        /// <param name= "Strclient" >Application Environment</param>        /// <param name= "Strlanguage" >language</param>        /// <param name= "Strrealdeprarea" >account Set code: ' 01 ', ' 02 ', ' the '</param>        /// <param name= "Strfiscalyear" >Fiscal Year</param>        /// <param name= "Strmonth" >accounting Monthly: ' mm '</param>        /// <returns>DataTable Data Set</returns>         Public StaticDataTable GetData (stringStrcompanycode,stringStrclient,stringStrlanguage,stringStrrealdeprarea,stringStrfiscalyear,stringstrmonth) {OracleConnection myoracleconnection=NULL; Try{DataTable dt=NewDataTable (); Myoracleconnection=NewOracleConnection (); Myoracleconnection.connectionstring= configurationmanager.connectionstrings["Fterp"].                ConnectionString;                Myoracleconnection.open (); OracleCommand cmd=NewOracleCommand ("Fxa_mainvalueinfo", myoracleconnection); Cmd.commandtype=CommandType.StoredProcedure; Cmd. Parameters.Add ("V_companycode", Oracletype.char). Direction = ParameterDirection.Input;//indicates that the passed in parameter is for the Oracle stored procedureCmd. parameters["V_companycode"]. Value =Strcompanycode; Cmd. Parameters.Add ("v_client", Oracletype.char). Direction =ParameterDirection.Input; Cmd. parameters["v_client"]. Value =strclient; Cmd. Parameters.Add ("V_language", Oracletype.char). Direction =ParameterDirection.Input; Cmd. parameters["V_language"]. Value =Strlanguage; Cmd. Parameters.Add ("V_realdeprarea", Oracletype.char). Direction =ParameterDirection.Input; Cmd. parameters["V_realdeprarea"]. Value =Strrealdeprarea; Cmd. Parameters.Add ("V_fiscalyear", Oracletype.char). Direction =ParameterDirection.Input; Cmd. parameters["V_fiscalyear"]. Value =strfiscalyear; Cmd. Parameters.Add ("V_postperiod", Oracletype.char). Direction =ParameterDirection.Input; Cmd. parameters["V_postperiod"]. Value =Strmonth; Cmd. Parameters.Add ("V_returnvalue", Oracletype.float). Direction =ParameterDirection.Output; OracleDataAdapter da=NewOracleDataAdapter (CMD); Da.                Fill (DT); stringeval = cmd. parameters["V_returnvalue"].                Value.tostring (); //myoracleconnection.close ();DataTable Dtresult =dt.                Clone (); foreach(DataRow Drinchdt. Rows) {DtResult.Rows.Add (Dr.                ItemArray); }                returnDtresult; }            Catch(Exception ex) {Throw NewException (ex.            ToString ()); }            finally            {                if(Myoracleconnection.state = =ConnectionState.Open) {myoracleconnection.close (); }            }        }
The following is an Oracle stored procedure, create OR REPLACE PROCEDURE bzrepdb. Fxa_mainvalueinfo (   v_companycode    in     char,   v_client     in Char,   v_language in     Char,   v_realdeprarea   in     char,   v_fiscalyear     in char,   v_postperiod     in     CHAR,   v_returnvalue out number       )

[C # for Oracle operations] C # action Call Orcale stored procedure has parameters

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.