Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Geometry From Text with Parameters

Author  Topic 

TommyGunn32
Starting Member

1 Post

Posted - 2009-09-10 : 13:34:21
Any ideas why the first query works but the second version with parameters doesn't? Does a parameter get rendered differently than how I'd expect, like with single quotes or anything?

Thanks for your time,

Tom

-----------

com.CommandText = @"UPDATE
Assets
SET
geom=Geometry::STPointFromText('POINT(" + feat.PointX.ToString() + " " + feat.PointY.ToString() +@")',0)
WHERE
AssetID=@AssetID;";

-----------

com.CommandText = @"UPDATE
Assets
SET
geom=Geometry::STPointFromText('POINT( @PointX_String @PointY_String )',0)
WHERE
AssetID=@AssetID;";

com.Parameters.AddWithValue("@PointX_String", feat.PointX.ToString());
com.Parameters.AddWithValue("@PointY_String", feat.PointY.ToString());
   

- Advertisement -