MAX value for a column? RRS feed

  • Question

  • Is there a way to query a datatable for the MAX value of column?  Can the Select() method be used in this manner?

    Wednesday, June 13, 2007 4:38 PM


  • Hi,

    You can use sql such as
    select max(Price) as MaxPrice from Products
    in combination with the ExecuteScalar method of the Command objects

    If all the data is in a dataset, you can use the Compute function of the DataTable object:

    Wednesday, June 13, 2007 7:26 PM