RoBb0 0 Newbie Poster

Hey all,

For my project I have decided to create a web app for a bus tracking system using ASP.NET/C# and SQL Server. The reason for doing it in ASP.NET is because I'm much better at it compared to writing PHP and Javascript code.

For one part of my app I have created a function where users are able to type in an address and the closes three bus stops (Stored in the DB) and is displayed to the user.

My coding is based off creating a Store locator, more specifically: http://www.4guysfromrolla.com/articles/051910-1.aspx

The problem I'm having trouble with is converting the values from Miles to Kilometers. Here is my code:

SELECT TOP 3 Stop_ID, Stop_Name, Stop_Suburb, Stop_PostCode, Stop_Description, Stop_Latitude, Stop_Longitude, SQRT(POWER(Stop_Latitude - @Stop_Latitude, 2) + POWER(Stop_Longitude - @Stop_Longitude, 2)) * 62.1371192 AS DistanceFromAddress 
FROM Stop
WHERE (ABS(Stop_Latitude - @Stop_Latitude) < 0.25) AND (ABS(Stop_Longitude - @Stop_Longitude) < 0.25) ORDER BY DistanceFromAddress

Any help would be greatly appreciated =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.