Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > LINQ query help

Reply
Thread Tools

LINQ query help

 
 
.nLL
Guest
Posts: n/a
 
      09-09-2009
Hi, i've got below query
--------------------------
TopCountriesRepeater.DataSource = ds.Tables[1].AsEnumerable()
.GroupBy(row => row.Field<string>("CountryCode"))
.Select(group => new { CountryCode = group.Key, CountryName
= group.Key, UsersFromIp = group.Sum(row =>
row.Field<int>("UsersFromIp")) })
.OrderByDescending(g => g.UsersFromIp);
-----------------------

What i want to do is instead of

CountryName = group.Key

I want to select "CountryName" column of the row when executing query.
Can someone give me heads up for this?

Thanks



 
Reply With Quote
 
 
 
 
miher
Guest
Posts: n/a
 
      09-10-2009


".nLL" <(E-Mail Removed)> az alábbiakat írta a következo üzenetben
news:JGRpm.87141$(E-Mail Removed)2...
> Hi, i've got below query
> --------------------------
> TopCountriesRepeater.DataSource = ds.Tables[1].AsEnumerable()
> .GroupBy(row => row.Field<string>("CountryCode"))
> .Select(group => new { CountryCode = group.Key, CountryName
> = group.Key, UsersFromIp = group.Sum(row =>
> row.Field<int>("UsersFromIp")) })
> .OrderByDescending(g => g.UsersFromIp);
> -----------------------
>
> What i want to do is instead of
>
> CountryName = group.Key
>
> I want to select "CountryName" column of the row when executing query.
> Can someone give me heads up for this?
>
> Thanks
>
>


Hi,

Try something like :
CountryName = group.First().Field<...>("...")

-Zsolt

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linq or not Linq George ASP .Net 4 11-05-2008 04:53 PM
HowTo? LINQ Query Table Name (Range Variable) Not Known Until Runtime Joey ASP .Net 1 04-23-2008 04:33 PM
SQL Query to Linq (Group By and Sum) Alex Sauceda ASP .Net 6 02-04-2008 10:26 PM
LINQ Query shapper ASP .Net 2 10-18-2007 02:59 PM
Please translate this C# LINQ query into VB for me !!!!! ChrisN ASP .Net 1 08-07-2007 07:29 AM



Advertisments