I Used…
Dt.Select(“[Result] = ‘Fail’”).CopytoDatatable.RowCount
But…
An error occurs if there is no ‘Fail’ data.
How can I find the number by query?
I Used…
Dt.Select(“[Result] = ‘Fail’”).CopytoDatatable.RowCount
But…
An error occurs if there is no ‘Fail’ data.
How can I find the number by query?
You need not do copytodatatable you can directly use count that way you wont get any error
also another way is dt.AsEnumerable.Where(function(x) x("Result").ToString.Equals("Fail")).Count
or your way Dt.Select("[Result] = 'Fail'").Count
cheers
Filter Data Table on Result = “Fail” into a tempDT
If tempDT.Rows.Count > 0
Then get ConsumerNumber
Else do whatever is necessary if there are no Fails
dt.Asenumerable.Where(Function(row) row(“Result”).tostring.ToLower.Equals(“fail”)).count
Hi @minth08
Try this:
dt.AsEnumerable().Where(Function(row) row.Field(Of String)("Result") = "Fail").Count()
I/P :
Hope it helps!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.