在控制器(Mvc EntityFrameWork)中调用存储过程,但不知道我在做什么错误

时间:2016-08-10 10:12:06

标签: asp.net-mvc entity-framework c#-3.0

这是我导入到模型中的存储过程:

public virtual ObjectResult<Nullable<decimal>> CPNRNTLRT(string pRDID, Nullable<System.DateTime> iSSDT, string tENORID, Nullable<System.DateTime> mATDT, ObjectParameter rESULT)
    {
        var pRDIDParameter = pRDID != null ?
            new ObjectParameter("PRDID", pRDID) :
            new ObjectParameter("PRDID", typeof(string));

        var iSSDTParameter = iSSDT.HasValue ?
            new ObjectParameter("ISSDT", iSSDT) :
            new ObjectParameter("ISSDT", typeof(System.DateTime));

        var tENORIDParameter = tENORID != null ?
            new ObjectParameter("TENORID", tENORID) :
            new ObjectParameter("TENORID", typeof(string));

        var mATDTParameter = mATDT.HasValue ?
            new ObjectParameter("MATDT", mATDT) :
            new ObjectParameter("MATDT", typeof(System.DateTime));

        return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Nullable<decimal>>("CPNRNTLRT", pRDIDParameter, iSSDTParameter, tENORIDParameter, mATDTParameter, rESULT);
    }

我正在这样打电话

        using (var context = new IPSMSEntities())
        {
            System.Data.Objects.ObjectParameter output = new System.Data.Objects.ObjectParameter("CPNRNTLRT", typeof(decimal));                

            var a = context.CPNRNTLRT("SUKUK", IssueDate, customer.TENOR_ID, MaturityDate,output);

        }

但它给了我EntityCommandExecutionException was Unhandled By User

0 个答案:

没有答案