I am new to c# and need to write a program that will process GPS postion data from a sql server database and then calculate the total distance traveled for each unit listed by date. Each record contains a transaction id, date/time stamp, unit id, latitude and longitude. I have bound this table to a dataset. I also have a class for the haversine formula which will accepts the fields LAT (A) LON (A), LAT(B), LON (B). Where I am stuck is how to process the data from the data set (Keeping in mind that the data needs to be read one record at a time) and then loop through the records, apply the haversine formula then subtotal by unit and date. The final step would be to insert a record into a new table that contains the Equipment ID, Date, and total miles . Attached is the class I plan to use and sample data. Any suggestions would be greatly appreciated.