Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
I got this select
 
var qDuration = from rowU in DataAccess.metadata.um_User
                                join rowLC in DataAccess.metadata.um_CallLog
                                on rowU.userID equals rowLC.userID
                                group rowLC by new { userID = rowLC.userID } into groupN
                                select new
                                {
                                    userID = groupN.Key.userID,
                                    noOfCalls = groupN.Count(),
 
                                    totDurationSec = (from row in groupN
                                                      select row.Duration.Seconds).Sum(),
                                    totDurationMin = (from row in groupN
                                                      select row.Duration.Minutes).Sum(),
                                    totDurationHours = (from row in groupN
                                                      select row.Duration.Hours).Sum(),
                                    
                                };
now I wanna populate my time span with sums I did in this select
 
   var qTime = new TimeSpan(1, 0, 0);
                string Dislay = qTime.ToString()
Posted 20-Feb-13 0:48am
kolisa523
Edited 20-Feb-13 1:03am
v2
Comments
Sandeep Mewara at 20-Feb-13 9:17am
   
And... the issue is?
kolisa at 20-Feb-13 10:04am
   
i have separated by min,hr,sec sum ,how can i combine those to get 0:00:00 in timespan

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If you have separated the hours, minutes and seconds, just call:
 
<pre lang="cs">var qTime = new TimeSpan(HOURS, MINUTES, SECONDS);
                string Dislay = qTime.ToString()
  Permalink  
Comments
kolisa at 21-Feb-13 1:56am
   
my problem I can access the,totDurationSec cos they are inside a select and I cant make them global

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 385
1 George Jonsson 339
2 CPallini 335
3 BillWoodruff 314
4 OriginalGriff 227
0 OriginalGriff 5,030
1 CPallini 4,225
2 Sergey Alexandrovich Kryukov 3,604
3 George Jonsson 2,831
4 Gihan Liyanage 2,386


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100