Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got this select

SQL
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

C#
var qTime = new TimeSpan(1, 0, 0);
             string Dislay = qTime.ToString()
Posted
Updated 20-Feb-13 1:03am
v2
Comments
Sandeep Mewara 20-Feb-13 9:17am    
And... the issue is?
kolisa 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

If you have separated the hours, minutes and seconds, just call:

C#
<pre lang="cs">var qTime = new TimeSpan(HOURS, MINUTES, SECONDS);
                string Dislay = qTime.ToString()

 
Share this answer
 
Comments
kolisa 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900