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

Using Linq to call a stored procedure that passes a single line. The stored procedure returns a dataset string containing the string and int.

the code:

PESQLDataContext pe = new PESQLDataContext(strConnStr); pe.ObjectTrackingEnabled = false; gvUnitsPassed.DataSource = pe.PassedInspection(Line); gvUnitsPassed.DataBind(); pe.dispose(); 

When the code throws an exception, the following is called: The exception is selected in the result_exe statement IExecuteResult: 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 _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 work fine.

thanks

+4
source share
1 answer

I am sure this line is causing the problem:

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

In particular, a bit of a string. It must be a data type defined by a field, as in a stored proc. e.g. varchar (...), ntext, etc.

+7
source

Source: https://habr.com/ru/post/1307601/


All Articles