If you have it as a DataTable variable , you can assign the array to it and
then
specify a SQL statement to it like:

select max( [column_name] from [Table_Name]  group by [column_name].

this is just of the top of my head and haven't really worked it out..

Hope it works.



On Fri, Feb 20, 2009 at 9:53 AM, Peter Smith <[email protected]> wrote:

> On Thu, Feb 19, 2009 at 10:21 AM, techBuyer <[email protected]> wrote:
>
>>
>> Does anyone know the method to locate the highest value in an array or
>> collection or group of data?  Your help is much appreciated.
>>
>
> Locate...ah, you don't want the VALUE, you want the INDEX of the value....
>
> I'd use LINQ....
>
> http://www.google.com/search?q=LINQ+to+get+highest+value
>
> Brings me to
>
>
> http://stackoverflow.com/questions/462699/how-do-i-get-the-index-of-the-highest-value-in-an-array-using-linq
>
> int maxIndex = -1;
> int index=0;
> double maxValue = 0;
>
> int urgh = sequence.Select(value => {
>     if (maxIndex == -1 || value > maxValue)
>     {
>         maxIndex = index;
>         maxValue = value;
>     }
>     index++;
>     return maxIndex;
>  }).Last();
>
>
> That should do it for ya. :).
>

Reply via email to