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

Calling Stored procedure in controller(Mvc EntityFrameWork) but dont know what i am doing Wrong

提问人:Mussaib Siddiqui 提问时间:8/10/2016 最后编辑:Bassam AlugiliMussaib Siddiqui 更新时间:8/10/2016 访问量:103

问:

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

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

ASP.NET-MVC 实体框架 C#-3.0

评论


答: 暂无答案