传递带逗号分隔值

时间:2015-09-02 14:36:08

标签: asp.net-mvc entity-framework-5

我在testdb.context.cs中有一个函数,它在数据库中执行一个过程,我的一个参数是字符串,它可能/可能不带逗号分割值(“2,3”)map的数据类型是nvarchar但是在从我的代码执行该proc期间,它正在抛出错误输入字符串,格式不正确

代码:

public virtual ObjectResult Getdata_Result(Nullable Id,string country)         {             var IDParameter = Id.HasValue?                 new ObjectParameter(“Id”,Id):                 new ObjectParameter(“Id”,typeof(int));

        var CountryParameter = country!= null ?
            new ObjectParameter("country", country) :
            new ObjectParameter("country", typeof(string));

return((IObjectContextAdapter)this).ObjectContext.ExecuteFunction(“Usp_Getdata”,IDParameter,CountryParameter) }

任何建议都非常感谢。谢谢

1 个答案:

答案 0 :(得分:0)

我的不好,我的模型上下文没有更新。在对过程进行更改后,必须更新模型上下文。右键单击ER Diagram>单击更新模型>刷新您的过程