linq to sql how to get column totals

I have created a sql server view and am using linq to sql to read it.

  var testQuery = (from customers in dc.viewCustomers                                    
                                    selectcustomers);

Now the query returns column totalprice that is a money datatype in sql server

I want to amend the query so I get the SUM of totalprice.  
     

These are all
mugseyAsked:
Who is Participating?
 
GuitarRichConnect With a Mentor Commented:
try this:
decimal totalPriceSum = (from customers in dc.viewCustomers
                         select customers.totalprice).Sum();

Open in new window

0
 
GuitarRichCommented:
this page has loads of good examples that help me with LINQ http://msdn.microsoft.com/en-us/vbasic/bb688085.aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.