Bharadwaj
Bharadwaj

Reputation: 2553

using CopyToDataTable with ienumerable select

I have a DataTable which I am filtering by converting it to Enumerable as

_dt.AsEnumerable().Select(Function(s) s.Field(Of String)("LF").Trim().Contains(sFilter)).Take(25).Cast(Of DataRow).CopyToDataTable()

I am getting exception while execution as Unable to cast object of type 'System.Boolean' to type 'System.Data.DataRow'. Where I went wrong?

Upvotes: 0

Views: 332

Answers (1)

sdf
sdf

Reputation: 189

You select Booleans as a result of the function. Try Using Where instead of select.

Upvotes: 1

Related Questions