C # Get the return value of an Oracle stored procedure 1

Source: Internet
Author: User

/// <summary>        ///returns the value of the simulated self-increment field for the corresponding table/// </summary>        /// <param name= "tablename" >Table name</param>        /// <returns>table's simulated self-increment field value</returns>         Public decimalGetpknum (stringtablename) {            Switch(sqltype) { Case "MSSQL2008": Parameters=NewList<dbparameter>(); Parameters. ADD (NewSqlParameter ("@table_name", SqlDbType.VarChar, -)); Parameters. ADD (NewSqlParameter ("@key_value", Sqldbtype.decimal,9)); parameters[0]. Value =TableName; parameters[1]. Direction =ParameterDirection.Output;  Break;  Case "Oracle": Parameters=NewList<dbparameter>(); Parameters. ADD (NewOracleParameter (": Tb_name", ORACLE.MANAGEDDATAACCESS.CLIENT.ORACLEDBTYPE.VARCHAR2, -)); Parameters. ADD (NewOracleParameter (": Key_value", Oracle.ManagedDataAccess.Client.OracleDbType.Decimal)); parameters[0]. Value =TableName; parameters[0]. Direction =ParameterDirection.Input; parameters[1]. Direction =ParameterDirection.Output;  Break; default: Break; } idbhelper DBHelper=Dbfactory.createdbhleper (); returnDBHelper. Runprocedure (Utility.db.pubconstant.connectionstring,parameters,"Up_get_table_key"); }
Idbhelper dbhelper = dbfactory.createdbhleper (); a dbhelp file was created in the background, if it was an Oracle database  DBHelper Oraclehelper file
This Oracle stored procedure has two parameters, Key_value is the return parameter out
Utility.DB.PubConstant.ConnectionString is a database connection string
"Up_get_table_key" is the stored procedure name

C # Get the return value of an Oracle stored procedure 1

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.