How to use Max to retrieve Max value from a field in the dataset?

V

Vanessa

Hi
I would like to know how to Retrieve the Max Value from a field in the
DataSet? Is there any example?

Regards
Vanessa
 
N

Neil McKechnie

Vanessa,
The simplest way is to add a column to the DataTable and set its expression
property to be Max(colname) where colname is the field you are interested
in. Every row in the datatable will then have a field with the same value.

Alternatively, you can create a second datatable with a relationship to the
first, and add the expression column to the second table. Then the
aggregation (Max) will be carried out on a grouping basis via the
relationship.

You can also use a DataView, set it to sort by the field in question, then
retrieve the first row from the sorted dataview.

Hope this helps,
Neil.
 

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