This question is locked. New answers and comments are not allowed.
Hi. I'm trying to do a fairly simple linq statement using STIntersect on SQL Server 2012 geography types, but I keep getting errors that I don't understand.
I put this question in the Data Type forum because I suspect it might be something to do with Microsoft.SqlServer.Types ver 11
I put this question in the Data Type forum because I suspect it might be something to do with Microsoft.SqlServer.Types ver 11
//Attempt 1: Won't compile - "cannot convert type SqlBoolean to bool"
var myList = (from s
in
db.Suburbs where s.geom.STIntersects(myGeomPoint) == System.Data.SqlTypes.SqlBoolean.True.Value select s.SuburbName).ToList();
//Attempt 2: OpenAccessException - "The query does not accept parameters, but valid params were passed for query excecution"
var myList = (from s
in
db.Suburbs where (
bool
)s.geom.STIntersects(myGeomPoint) select s.SuburbName).ToList();
//Attempt 3: InvalidOperationException - "No AdoTypeConverter has been registered for the clrType."
var myList = (from s
in
db.Suburbs where s.geom.STIntersects(myGeomPoint).ToString() ==
"True"
select s.SuburbName).ToList();