To get distinct rows:
using System.Linq;
var distinctRows = dt.DefaultView.ToTable(true, "Resource_x0020_ID").Rows.OfType<DataRow>().Select(k => k[0] + "").ToArray();
To filter using where:
var product = from row in tempTable.AsEnumerable()
where row.Field<int>("ProdID") == 100 &&
(row.Field<string>("Category") != "Closed" ||
row.Field<string>("Type") == "Electroncs")
select row;
DataRow[] results = table.Select("A = 'foo' AND B = 'bar' AND C = 'baz'");
To get count:
int count = dt.Select("Product_x0020_Type = 'Mobile'").Length;
int blrCount = dt.Select("Work_x0020_Location like '%Bangalore%'").Length;
No comments:
Post a Comment