开发者

Linq The specified type 'string' is not a valid provider type

Using Linq to call a stored procedure that passes a single string, The stored procedure returns a data set row that contains a string and an int.

Code:

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

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

pe.dispose();

When the code runs an exception gets called below: The exception is thrown at the IExecuteResult result = statement: Enclosed is my result class in the designer.cs file.

[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 开发者_JAVA技巧_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;
                }
            }
        }
    }
}

I have other stored procedures with similar arguments that run just fine.

Thanks


I'm pretty sure it's this line causing the problem:

[Column(Storage = "_Date", DbType = "string NULL")]

Specifically the "string" bit. It should be the datatype the field is defined as in the stored proc. eg varchar(...), ntext etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜