How to sum a field in DataSet or Dataview?

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
 
V

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top