Calculate the Total of Particular Column in GridView using C#

Last Reply on Nov 21, 2016 03:17 AM By Shaiwal

Posted on Nov 20, 2016 10:53 PM

hi Developers i have a table Called tblPrice

i want to Calculate Calculate the Total Table Particular Column Row Values.
in my tblPrice table if i have values like

Id Name Cost
1 Mobile 1000
2 T.V. 2000
3 Camera 500

My Expected the Output is should be 3500. (Cost Column Row[1]+Row[2]+Row[3])
i am try to do i did't get exact output. so please help me to how i done my Requirement . I have no time so i can't able to try more

thanking You

You are viewing reply posted by: Shaiwal on Nov 21, 2016 03:17 AM.
Posted on Nov 21, 2016 03:17 AM

You need SUM Method in Sql Server. Here is your desired query.

select SUM(Cost) from tblPrice

Then simply display in your c# Project.