How can I read values from two consecutive rows from SqlDataReader at the same time ?!
SqlCommand query2 = new SqlCommand("SELECT lon , lat FROM Student Where B_ID = @B_ID ORDER BY Distance ASC");
// some value for @B_ID
query2.Connection = cn;
SqlDataReader readStd = query2.ExecuteReader();
while (readStd.Read())
{
// here I want to calculate the distance between each consecutive rows
// by taking the latitude and longitude from each row
double d = DistanceBetweenPlaces(Convert.ToDouble(readStd.GetValue(0)), Convert.ToDouble(readStd.GetValue(1)), ???, ???);
totalDistance = totalDistance + d;
//}
}