I've searched around and I've seen you can access the latitude with myGeography.Lat
but it doesn't seem to work when trying to read to sqldatareader
, this is what I'm trying:
String sql = "SELECT * FROM myTable WHERE myGeography.STDistance(geography::Point(somelatitude, somelongitude, 4326)) <somerange
SqlDataReader reader = command.ExecuteReader()
int lat,long
lat = reader["myGeography.Lat"]
long = reader["myGeography.Long"]