How to sum a field in DataSet or Dataview?

  • Thread starter Thread starter Vanessa
  • Start date Start date
V

Vanessa

Hi,
I'm using DataSet and Grid. My Grid is bound to DataView. Is there a way for
me to do a Sum a particular field of all the records in the DataSet or
dataview?

Regards
Vanessa
 
Hi, I have use the Compute method in the dataset but it gives me an error "
Cast from type 'DBNull' to type 'String' is not valid". Why is this so?
My code is as follow:
txtGrandTotal.text =
dsTempGrand.Tables("sqlMhcSys").Compute("Sum(SellPrice)", "SellPrice Is Not
Null")



Regards
Vanessa
 
Back
Top