Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 31st, 2006, 10:50 AM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default Adding up Column Values within a Datatable

Hi All

I would love to give you an example of what I have tried so far but haven’t a clue!!...

I have a database connection and have filled a datatable and would like to be able to get the aggregate figure for certain columns within the datatable. Please could somebody guide me in the right direction on how to do this?

Many thanks

Rit
__________________
Rit
www.designandonline.co.uk
INSPIRE | CREATE | DELIVER
 
Old May 31st, 2006, 11:27 AM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

OK, I think I might be going down the right route...

Dim QtyVal as Integer = Convert.ToInt32(MyDataTable.Compute("Sum(qty)", "site = 4 "))

... Does anyone know how I could achieve the above but without it filtering?.. I could do with it adding up ALL of the values within the field 'qty' from the whole datatable.

Many thanks

Rit





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the value from the DataTable column Dmitriy Pro VB 6 4 March 30th, 2010 08:58 AM
Rearrange the column order in a datatable/dataset kiran_q8 ASP.NET 2.0 Basics 6 July 3rd, 2007 12:12 PM
Rearrange the column order in a datatable/dataset kiran_q8 ASP.NET 2.0 Professional 2 May 3rd, 2007 08:46 AM
Adding rows, AND column(s) to existing datatable cliffd64 VB.NET 2002/2003 Basics 1 August 18th, 2005 06:50 AM
adding rows to datatable forkhead ADO.NET 2 March 18th, 2004 01:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.