asp.net - C# SQL Geometry Error: Invalid operator for data type. Operator equals equal to, type equals geometry -


using c# , local sql server making sql call is:

string cmd2 = "select circle_id circle center_point = geometry::stgeomfromtext('point(";         cmd2 += center_lat;         cmd2 += " ";         cmd2 += center_lng;         cmd2 += ")',0)"; 

and receive error:

invalid operator data type. operator equals equal to, type equals geometry. error number:403,state:1,class:16

syntax believe correct referencing #ref1 , #ref2.

note: understand parameterized sql queries doing. first want sql working. thanks

the data type allows operations , not standard.

the solution found was:

 string cmd2 = "select circle_id circle center_point.stequals(geometry::stgeomfromtext('point(";         cmd2 += center_lat;         cmd2 += " ";         cmd2 += center_lng;         cmd2 += ")',0)) = 1;"; // 1 = true 

this post helped me out.

hope helps others in future.


Comments