Dataset math

  • Thread starter Thread starter Graeme
  • Start date Start date
G

Graeme

Hi.I'm lost.

Winforms, ADO.Net, VB.Net

Have a datagrid which is populated with a subset of my table using SQL
query. What I want is the total of one column ("Sales") which I need to
write into a textbox.

Have had no success so far.

Thanks for any help.
Graeme
 
The computer method should do it for you...
Dim i As Integer =
CType(AllData.Tbl_Job_Tracking.Compute("SUM(Line_Count_1)", "Line_Count_1
=0"), Integer)
someTextBox.Text = i.ToString("#,##0.00")
 
Thanks Ryan. I'm learning, but still haven't a clue how to use this. I think
....
I rename Tbl_Job_Tracking to my table name
AllData?? Line_Count_1??
Not sure where to fit this method into code. Can you help further?
Thanks
Graeme

Line_Count_1
 
Hi Greame,

AllData is dataset to which table Tbl_Job_Tracking belongs.
If your table is standalone (not a part of dataset) you can omit alldata.
part.
Line_Count_1 is field that has to be sumarized.

Use this method when you need to compute the sum (probably before outputing
the result).
 
Cool! Well, that took me about 2 days or searching old threads to no avail.
But this works perfectly! Thanks both!!!

Miha Markic said:
Hi Greame,

AllData is dataset to which table Tbl_Job_Tracking belongs.
If your table is standalone (not a part of dataset) you can omit alldata.
part.
Line_Count_1 is field that has to be sumarized.

Use this method when you need to compute the sum (probably before outputing
the result).

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Graeme said:
Thanks Ryan. I'm learning, but still haven't a clue how to use this. I think
...
I rename Tbl_Job_Tracking to my table name
AllData?? Line_Count_1??
Not sure where to fit this method into code. Can you help further?
Thanks
Graeme

Line_Count_1
 
Back
Top