Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Linq Syntax
Message
 
To
All
General information
Forum:
ASP.NET
Category:
LINQ
Title:
Linq Syntax
Environment versions
Environment:
VB 8.0
OS:
Vista
Network:
Windows XP
Database:
Jet/Access Engine
Application:
Desktop
Miscellaneous
Thread ID:
01524641
Message ID:
01524641
Views:
96
Can this be done in one statement, i.o.w how do I define an Order By clause with a select Group Select New construction?
        Dim orders As IEnumerable(Of DataRow) = osql.dt.AsEnumerable
        Dim Test2 = From r In orders _
            Group r By nummer = r.Field(Of String)("KL_Nummer"), name = r.Field(Of String)("KL_Naam"), artBtw = r.Field(Of Double)("ArtBtw") _
            Into g = Group Select New With {.Nummer = nummer, .Name = name, .artbtw = artBtw, .total = g.Sum(Function(r) _
                r.Field(Of Decimal)("Bestd_Waarde") * (1.0 - CDbl(If(r("art_korting") = False, 0.0, If(r("kkkorting") Is DBNull.Value, CDbl(r("KLkorting")), CDbl(r("KKKorting")))))))}
        Dim test = From r In Test2 Order By r.Name

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Next
Reply
Map
View

Click here to load this message in the networking platform