Go Back   SitePoint Forums > Forum Index > Program Your Site > .NET
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Nov 27, 2009, 02:48   #1
ywndotno
SitePoint Member
 
Join Date: Oct 2009
Posts: 8
ASP.Net 3.5 and Linq with VB.NET

Hi

I am fairly new to asp programming and having a headache with this Linq query:

I'm trying to get the average price from a list of prices: from (THIS SHOULD BE A LINK) MSDN: How to: Count, Sum, or Average Data by Using LINQ (Visual Basic)
I understand i have to write the code like this: dim averagePrice = Aggregate price In db.items Into Average()

I have also tried with:
dim countPrice = Aggregate price In db.items Into Count() Wich works fine!
dim sumPrice = Aggregate price In db.items Into Sum() Wich dont work at all!

as for the sum try i understand i have to have something in the parentheses of Sum() but i have no clue of what to have there. As I said i'm fairly new to this.

ywndotno
ywndotno is offline   Reply With Quote
Old Dec 1, 2009, 21:54   #2
ywndotno
SitePoint Member
 
Join Date: Oct 2009
Posts: 8
managed to solve by help from a classmate

Dim snitt = Aggregate eierskaps In db.eierskaps Into Average(eierskaps.filmPris)
ywndotno is offline   Reply With Quote
Reply

Bookmarks

Tags
linq

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
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
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 14:10.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved