views:

57

answers:

0

Hi all

I have got the following LINQ query, apologies for the poor variable naming.

Dim bla3 = From c In crdc.SRAs _
           Where c.acad_period = ReviewCredential.AcadPeriod _
           And c.periodID = ReviewCredential.PeriodID _
           And c.aos_code = ReviewCredential.AoSCode _
           And c.aos_period = ReviewCredential.AoSPeriod _
Select c.expendyr, c.startminxfr, c.dur, _
    RetCompPercTC = c.retcompperctc, _
    RetCompPercBM = c.retcomppercbm, _
    RetContPercTC = c.retcontperctc, _
    Achievement = c.achperctc, _
    AchievementBM = c.achpercbm, _
    Success = c.succperctc, _
    SuccessBM = c.succpercbm, _
    HighStartPercTC = c.highstrtperctc, _
    HighStartPercBM = c.highstrtpercbm _
    Order By expendyr Descending

I have tried the solution posted here which offers the following soltuion

        var groups = from row in testList
              group row by row.SomeTime;
    foreach (var group in groups.OrderBy(group => group.Key))
    {
        Console.WriteLine(group.Key);
        foreach(var item in group.OrderBy(item => item.SomePrice))
        {
            Console.WriteLine(item.SomePrice);
        }
        Console.WriteLine("Total" + group.Sum(x=>x.SomePrice));
    }

but when I get to to the (var group in groups.OrderBy(group => group.Key)) line, there is no key method, so I cannot go any further. I assume that this is a primary key, how do I set this?

If there are any better ways to get a summary line out of a LINQ Query, I am open to suggestions...