Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 与';getRunNo(int,ref string,ref int,int)和#x27;有一些无效的参数_C#_.net - Fatal编程技术网

C# 与';getRunNo(int,ref string,ref int,int)和#x27;有一些无效的参数

C# 与';getRunNo(int,ref string,ref int,int)和#x27;有一些无效的参数,c#,.net,C#,.net,我不确定我做错了什么。第一种方法,我在DBFunctions类中定义了一些参数ByRef public string getRunNo(int REQ_ID, ref string file_name, ref int run_no, int MEMBER_ID) { string vError = String.Empty; Oracle.DataAccess.Client.OracleParameter[] parameter

我不确定我做错了什么。第一种方法,我在DBFunctions类中定义了一些参数ByRef

 public string getRunNo(int REQ_ID, ref string file_name, ref int run_no, int MEMBER_ID)
        {
            string vError = String.Empty;
            Oracle.DataAccess.Client.OracleParameter[] parameters;
            parameters = new Oracle.DataAccess.Client.OracleParameter[6];
            for (int i = 0; i <= 6; i++)
            {
                parameters[i] = new Oracle.DataAccess.Client.OracleParameter();
            }
            parameters[0].ParameterName = "vREQ_ID";
            parameters[0].Value = REQ_ID;
            parameters[0].Direction = System.Data.ParameterDirection.Input;

            parameters[1].ParameterName = "vMEMBER_ID";
            parameters[1].Value = MEMBER_ID;
            parameters[1].Direction = System.Data.ParameterDirection.Input;

            parameters[2].ParameterName = "vFILE_TYPE";
            parameters[2].Value = "ENQUIRY";
            parameters[2].Direction = System.Data.ParameterDirection.Input;

            parameters[3].ParameterName = "vSUB_FILE_TYPE";
            parameters[3].Value = "E";
            parameters[3].Direction = System.Data.ParameterDirection.Input;

            parameters[4].ParameterName = "vFILE_NAME";
            parameters[4].Direction = System.Data.ParameterDirection.Output;

            parameters[5].ParameterName = "vRUN_NO";
            parameters[5].Direction = System.Data.ParameterDirection.Output;

            parameters[6].ParameterName = "vERR";
            parameters[6].Direction = System.Data.ParameterDirection.Output;

            string V_Error;
            OracleCommand MyCom = new OracleCommand("P_GENERATE_SIMAH_FILE_NAME", conn);

            MyCom.CommandType = CommandType.StoredProcedure;
            foreach (OracleParameter p in parameters)
            {
                MyCom.Parameters.Add(p);
            }

            try
            {
                MyCom.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                V_Error = ex.Message;
                return V_Error;
            }
            V_Error = MyCom.Parameters["vERR"].Value.ToString();
            if (V_Error == "-")
            {

            }

            return V_Error;
        }
但我得到了以下错误:

与'DBFunctions.getRunNo(int,ref)匹配的最佳重载方法 字符串,ref int,int)“”具有一些无效参数

你能确定错误的原因吗。如果我删除“ref”,它可以正常工作,但我需要引用变量

谢谢,
Noorul

如果您有
ref
out
参数,则需要在调用方法时向参数添加
ref
out

res = df.getRunNo(REQ_ID, ref file_name, ref RUN_NO, head.MEMBER_ID);

话虽如此,我看不到您在
getRunNo
中分配给
file\u name
run\u no
的位置,因此看起来这些参数根本不需要是
ref

谢谢您的帮助。是的,我没有将值分配回引用的参数。
res = df.getRunNo(REQ_ID, ref file_name, ref RUN_NO, head.MEMBER_ID);