I am reading an Excel document using ADO.Net in a dataset. Dataset Contains a set of employee records that contain login and logout times as Datatable. I need the first employee accounts and the most recent logon time to be the final record from the recordset based on the employee id and date. Here is my example data:
Emp Id Name Login Logout 12345 RAMACHANDRAN 7/30/2013 8:40 7/30/2013 10:40 12345 RAMACHANDRAN 7/30/2013 12:30 7/30/2013 14:20 12345 RAMACHANDRAN 8/01/2013 18:10 8/01/2013 20:20 12345 RAMACHANDRAN 8/01/2013 20:40 8/01/2013 22:00 12346 RAVI 8/03/2013 12:30 8/03/2013 14:20 12346 RAVI 8/03/2013 18:10 8/03/2013 20:20
I need a final recording with a calculated duration
Emp Id Name Login Logout Duration 12345 RAMACHANDRAN 7/30/2013 8:40 7/30/2013 14:20 5:40 12345 RAMACHANDRAN 8/01/2013 18:10 8/01/2013 22:00 3:50 12346 RAVI 8/03/2013 12:30 8/03/2013 20:20 7:50
Is this the best way to use Linq to query this dataset? Which way is the best
source share