執行儲存過程時,返回引數示例程式碼
阿新 • • 發佈:2018-11-19
//引數
SqlParameter[] fparams = new SqlParameter[7];
fparams[0] = new SqlParameter("@ID", ID);
fparams[1] = new SqlParameter("@VoucherAmt", VoucherAmt);
fparams[2] = new SqlParameter("@ItemId", ItemId);
fparams[3] = new SqlParameter("@AmortizeType", AmortizeType);
fparams[4] = new SqlParameter("@AmortizeDate", AmortizeDate);
fparams[5] = new SqlParameter("@AmortizeCount", AmortizeCount);
fparams[6] = new SqlParameter("@returnVal", SqlDbType.NVarChar, 2000);
fparams[6].Direction = ParameterDirection.Output;
//執行儲存過程
_unitOfWork.ExcuteSql("EXEC [PROC_AMORTIZE] @ID,@VoucherAmt,@ItemId,@AmortizeType,@AmortizeDate,@AmortizeCount,@returnVal OUTPUT", fparams);
string IdList = fparams[6].Value.ToString();
return IdList;