Which activity provides the easiest way to loop through all the rows in a datatable?
Answers
Answered by
0
If it’s a specific column, you can put an If activity inside the For Each Row activity and put the following condition:
row.Item("ColumnName").ToString.Contains("word")
If it’s any column, inside the For Each Row you can put a For Each activity and iterate through datatable.Columns and inside this loop put the If activity with the following condition:
row.Item(column.ColumnName).ToString.Contains("word")
, where ‘column’ is the current iteration of the datatable.Columns loop.
If you want to extract all rows that meet this condition and only iterate through these for further processing, you can use LINQ to obtain the rows:
datatable.AsEnumerable().Where(Function(x) x.Item("ColumnName").ToString.Contains("word")).ToArray
Similar questions
English,
7 months ago
Math,
7 months ago
Math,
7 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Geography,
1 year ago
Science,
1 year ago
History,
1 year ago