Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sum of Dataset column

Posted on 2004-09-30
4
Medium Priority
?
661 Views
Last Modified: 2008-03-03
I have a data set called MyDataSet
Then i have a datatable called MyDataTable

I want to get the sum of column 3

How would I do this ?


Thank You
0
Comment
Question by:Vartana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 28

Accepted Solution

by:
iboutchkine earned 2000 total points
ID: 12192866
Private Sub ComputeBySalesSalesID(ByVal myDataSet As DataSet)
    ' Presumes a DataTable named "Orders" that has a column named "Total."
    Dim myTable As DataTable
    myTable = myDataSet.Tables("Orders")
    ' Declare an object variable.
    Dim objSum As Object
    objSum = myTable.Compute("Sum(Total)", "EmpID = 5")
 End Sub
0
 
LVL 1

Author Comment

by:Vartana
ID: 12192943
I dont want to filter anything

How can i do it without filtering
0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12193149
put criteria for filter that will match all the records.
FOr example you want to calculate quantity
objSum = myTable.Compute("Sum(Qty)", "Qty>0")
0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12193224
also you can use Nothing for filter
objSum = myTable.Compute("Sum(Qty)", Nothing)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question