1
我不知道我做錯了。第一種方法,我定義一些參數爲ByRef一類DBFunctions爲「DBFunctions.getRunNo(INT,參考線,裁判INT,INT)」的最佳重載的方法匹配具有一些無效參數
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;
}
這裏,在第二類中,我實例化,並調用函數
res = df.getRunNo(REQ_ID, file_name, RUN_NO, head.MEMBER_ID);
,但我收到以下錯誤:
The best overloaded method match for 'DBFunctions.getRunNo(int, ref string, ref int, int)' has some invalid arguments
請問您能否確定錯誤原因。如果我刪除了「裁判」,它工作正常,但我需要引用變量。
感謝, Noorul
感謝您的幫助。是的,我錯過了分配值回參考參數。 – Noorul