In my datatable I have two rows with multiple columns.
One of the columns are ItemID
and their values are 2215,2216
.
When I use the following statement:
DataRow[] dr = dt.Select("ItemID='2215'");
It returns both rows. It's not filtering.
What I am missing?
This should work if your table has data with the structure you described.
var dr = from row in dt.AsEnumerable()
where row.Field<int>("ItemID") == 2215
select row;
DataTable dtSelected = dr.CopyToDataTable();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With