Hi guys, How you doing today? Wish you all good.
By the way, here is my problem. I would like to display the total of sum duration in gridview by using LINQ to SQL. I have two tables, Users and Log_Times
Users
UserID-----Name
1------------Bob
2------------Mary
3------------Jane
Log_Times
ID---------------UserID--------------------TimeIn---------------------TimeOut
1--------------------1-----------------------1/1/2009 10:00:00-------1/1/2009 11:05:00
2--------------------2-----------------------1/1/2009 10:00:00-------1/1/2009 11:02:30
3--------------------3-----------------------1/1/2009 10:00:00-------1/1/2009 11:00:00
4--------------------1-----------------------1/2/2009 10:00:00-------1/2/2009 11:05:00
5--------------------2-----------------------1/2/2009 10:00:00-------1/2/2009 11:02:30
There would be so great, if our gentle man can generate report which looks like this:
UserName-------TotalDuration
Bob---------------2 Hours, 10 Minutes
Mary--------------2 Hours, 5 Minutes
Jane--------------1 Hour
I am using LINQ to SQL and VB.NET.
The code I have so far is:
Dim db = new LogTimeDataContext
Dim LogUser = from lu in db.Users select lu.Name, TotalDuration = ? ? ?
Gridview1.DataSource = LogUser
Gridview1.DataBind()
Please and please help me to figure out what is behind this TotalDuration code..
I really appreciate for taking your valuable time to pass through this problem and Im looking forward for the best response toward it. Thanks you very much in advance.