BTW, my loop code was bad, should be
For i = 0 to dsResults.Tables(0).Rows.Count -1
otherwise you'll get an out of bounds error
On 8/29/05, David Renz <[EMAIL PROTECTED]> wrote:
>
> sorry thomas ...
>
> dean's is a much more thorough explanation.
> didn't mean to be short there. :)
>
> david
>
>
>
> >>> [EMAIL PROTECTED] 08/29/2005 12:34:05 PM >>>
>
> 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 Links
>
>
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
--
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/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/