how to customize datatable.Select
-
I am writing a windows desktop application in C# 2008 and i wanna to have select for datatable :
IEnumerable<string> idsInA = dtd.AsEnumerable().Select(row => (string)row["ID"]);
it filters only on one row (ex.ID) but the thing i wanna is for three rows (ex:ID , Title , Path) Ho i can do that ?
-
I am writing a windows desktop application in C# 2008 and i wanna to have select for datatable :
IEnumerable<string> idsInA = dtd.AsEnumerable().Select(row => (string)row["ID"]);
it filters only on one row (ex.ID) but the thing i wanna is for three rows (ex:ID , Title , Path) Ho i can do that ?
IEnumerable idsInA =
(from row in dtd
where row["ID"] = idFilter && row["Title"] = titleFilter && row["Path"] = pathFilter
select row["ID"]).AsEnumerable();But this only returns one column, if you want all the columns, you would use something like this:
var rowsInA =
(from row in dtd
where row["ID"] = idFilter && row["Title"] = titleFilter && row["Path"] = pathFilter
select row);and then rowsInA is an IEnumerable that contains the row objects.
-
IEnumerable idsInA =
(from row in dtd
where row["ID"] = idFilter && row["Title"] = titleFilter && row["Path"] = pathFilter
select row["ID"]).AsEnumerable();But this only returns one column, if you want all the columns, you would use something like this:
var rowsInA =
(from row in dtd
where row["ID"] = idFilter && row["Title"] = titleFilter && row["Path"] = pathFilter
select row);and then rowsInA is an IEnumerable that contains the row objects.
thanks in advnaced! But i wanna to return all cells of my datatable ! (Not filter some !!! [No where])
-
thanks in advnaced! But i wanna to return all cells of my datatable ! (Not filter some !!! [No where])