Click here to Skip to main content
11,720,785 members (67,070 online)
Rate this: bad
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
Edited 20-Feb-13 1:03am
Joezer BH38.2K
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
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()
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 2,179
1 OriginalGriff 924
2 F-ES Sitecore 640
3 Maciej Los 609
4 Richard MacCutchan 540

Advertise | Privacy | Mobile
Web01 | 2.8.150901.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2015
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