Linq指定的类型"string"不是有效的提供者类型

Joe*_*itz 4 c# linq-to-sql

使用Linq调用传递单个字符串的存储过程,存储过程返回包含字符串和int的数据集行.

码:

 PESQLDataContext pe = new PESQLDataContext(strConnStr);
        pe.ObjectTrackingEnabled = false;

 gvUnitsPassed.DataSource = pe.PassedInspection(Line);
 gvUnitsPassed.DataBind();

pe.dispose();
Run Code Online (Sandbox Code Playgroud)

当代码运行时,下面会调用异常:IExecuteResult result =语句抛出异常:Enclosed是designer.cs文件中的结果类.

[Function(Name = "dbo.PassedInspection")]
    public ISingleResult<PassedInspectionResult> PassedInspection([Parameter(Name = "Model", DbType = "VarChar(4)")] string model)
    {
        IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), model);
        return ((ISingleResult<PassedInspectionResult>)(result.ReturnValue));
    }

    public partial class PassedInspectionResult
    {

        private string _Date;

        private int _Passed;

        public PassedInspectionResult()
        {
        }

        [Column(Storage = "_Date", DbType = "string NULL")]
        public string Date
        {
            get
            {
                return this._Date;
            }
            set
            {
                if ((this._Date != value))
                {
                    this._Date = value;
                }
            }
        }

        [Column(Storage = "_Passed", DbType = "Int NULL")]
        public int Passed
        {
            get
            {
                return this._Passed;
            }
            set
            {
                if ((this._Passed != value))
                {
                    this._Passed = value;
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我有其他存储过程与类似的参数运行得很好.

谢谢

Foo*_*ole 7

我很确定这条线是导致问题的原因:

[Column(Storage = "_Date", DbType = "string NULL")]
Run Code Online (Sandbox Code Playgroud)

特别是"字符串"位.它应该是字段在存储过程中定义的数据类型.例如varchar(...),ntext等