Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Newbie to Linq
Message
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Titre:
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01605340
Message ID:
01605423
Vues:
69
Hi Viv, here's some sample output from my query

Query
var results = (Context.invoices // Start at invoices because this is the list we really care about
                    .Include(inv => inv.client) // Eager load the client so it doesn't require additional queries
                    .Where(inv => inv.invoiceamount >= InvoiceAmount)
                    .OrderByDescending(x => x.invoiceamount)// Filter results
                    .GroupBy(inv => inv.client) // Group results by client so we can loop through the clients
                    .ToList()); // Execute the query
Sample output
Company: Steve Hall Fire Protection (id: 8)
	 Invoice reference: PJK\Steve Hall Fire Prevention\30-06-2014-0007
		 Invoice date: 30/06/2014
		 Invoice amount: £20,000,000.00
		 Charge type: Daily Rate
	 Invoice reference: PJK\Steve Hall Fire Prevention\30-06-2014-0008
		 Invoice date: 30/06/2014
		 Invoice amount: £20,000,000.00
		 Charge type: Daily Rate
	 Invoice reference: PJK\Steve Hall Fire Prevention\27-06-2014-0003
		 Invoice date: 27/06/2014
		 Invoice amount: £6,000,000.00
		 Charge type: Daily Rate
	 Invoice reference: PJK\Steve Hall Fire Prevention\30-06-2014-0005
		 Invoice date: 30/06/2014
		 Invoice amount: £20,000,000.00
		 Charge type: Daily Rate
	 Invoice reference: PJK\Steve Hall Fire Prevention\30-06-2014-0006
		 Invoice date: 30/06/2014
		 Invoice amount: £20,000,000.00
		 Charge type: Daily Rate
as you can see there's a 6,000,000.00 snuck in the middle - the same thing happens on all my test data.
Regards,
Peter J. Kane



Pete
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform