Linq The specified type 'string' is not a valid provider type.
Posted
by Joe Pitz
on Stack Overflow
See other posts from Stack Overflow
or by Joe Pitz
Published on 2010-04-21T22:07:10Z
Indexed on
2010/04/21
22:13 UTC
Read the original article
Hit count: 1153
linq-to-sql
|c#
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 _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
© Stack Overflow or respective owner