You can do this with a loop as you suggested...

Dim i as Integer
Dim dr as DataRow
Dim total as Double = 0
For i = 0 to dsResults.Tables(0).Rows.Count
  dr = dsResults.Tables(0).Rows(i)
  Total += dr("ColumToTotal")
Next

Or simply do it in SQL as David suggested

or

You can create a calculated column in your table and set up an
aggregate expression in ut.  See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatacolumnclassexpressiontopic.asp
for more info.

On 8/29/05, David Renz <[EMAIL PROTECTED]> wrote:
> why not use "Sum" (in Oracle) or some other aggregate function to do it
> with SQL?
> 
> 
> 
> 
> >>> [EMAIL PROTECTED] 08/29/2005 12:18:28 PM >>>
> 
> I wan't to subtotal column 'Amount' in my current dataset.  I figure I
> 
> need some kind of loop to go through each record but I just cant
> figure it out.  I have a counter set up.  Here is how I count the
> records. dsResults.Tables(0).Rows.Count
> Any help?
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> [Non-text portions of this message have been removed]
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 


-- 
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to