/// <summary> /// 获取ERP固定资产计提数据 /// </summary> /// <param name="strCompanyCode">公司代码</param> /// <param name="strClient">应用环境</param> /// <param name="strLanguage">语言</param> /// <param name="strRealDeprarea">账套代码:‘01’、‘02’、‘03’</param> /// <param name="strFiscalYear">会计年度</param> /// <param name="strMonth">会计月度:‘mm’</param> /// <returns>DataTable数据集</returns> public static DataTable getData(string strCompanyCode, string strClient, string strLanguage, string strRealDeprarea, string strFiscalYear, string strMonth) { OracleConnection myOracleConnection = null; try { DataTable dt = new DataTable(); myOracleConnection = new OracleConnection(); myOracleConnection.ConnectionString = ConfigurationManager.ConnectionStrings["FTERP"].ConnectionString; myOracleConnection.Open(); OracleCommand cmd = new OracleCommand("FXA_MAINVALUEINFO", myOracleConnection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("v_companycode", OracleType.Char).Direction = ParameterDirection.Input; //指明传入的参数是给Oracle存储过程用的 cmd.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 = new OracleDataAdapter(cmd); da.Fill(dt); string eval = cmd.Parameters["v_returnvalue"].Value.ToString(); //myOracleConnection.Close(); DataTable dtResult = dt.Clone(); foreach (DataRow dr in dt.Rows) { dtResult.Rows.Add(dr.ItemArray); } return dtResult; } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { if (myOracleConnection.State == ConnectionState.Open) { myOracleConnection.Close(); } } }
如下是Oracle的存储过程 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 )
时间: 2024-10-13 21:18:43