String strSQL = @"
DECLARE @g geography;
SET @g = geography::STGeomFromText('POINT (' + @x + ' ' + @y + ')', 4326);"
List
if (!string.IsNullOrEmpty(x))
{
SqlParameter item = new SqlParameter("x", SqlDbType.NVarChar);
item.Value = x;
list.Add(item);
}
if (!string.IsNullOrEmpty(y))
{
SqlParameter item = new SqlParameter("y", SqlDbType.NVarChar);
item.Value = y;
list.Add(item);
}
SQL 組法如下:
DECLARE @g geography;
DECLARE @x nvarchar = '120.73261855400006';
DECLARE @y nvarchar ='23.9832863352';
SET @g = geography::STGeomFromText('POINT (' + @x + ' ' + @y + ')', 4326);
沒有留言:
張貼留言