Convert problem to Data.DataTable

i’ve used a for each row , because i want to read some values to get the max and the min value(Prices)
But i get this error message ?
Compiler error encoutered processing expression “result”.
Option Stict Ib dusallows implicit conversions from ‘System.Collections.Generric.IEnumerable’(Of objet) to ‘System.Data.DataTable’
Any help please?
Thank u.

You’re probably using a generic For Each which needs to have the type property set to System.Data.DataRow.
There are lots of examples around: Search results for 'loop datatable for each' - UiPath Community Forum

1 Like

Hi there Hamza Soufiane,
As Badita has stated, you are likely utilising For Each when iterating, which is causing the disallowed conversion error.
If you specifically require the use of For Each then follow his advice, otherwise I would use For Each Row.

I have created a VERY basic component, which appears to complete what you require.

Thanks in advance!

forEachExample.xaml (17.1 KB)


Thank u.
But please there is a simple methode to get the max value from a table?

You can use Lambda expressions.
For example:

YourDataTable.AsEnumerable().Max(Function(res) res.Field(Of Int32)("Column0"))