Solved

Sum of Dataset column

Posted on 2004-09-30
4
660 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 500 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

632 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