I want to Select * from my datatable under some condition and put the return value in the same datatable.
dt = from myRow in dt.AsEnumerable()
where !string.IsNullOrEmpty( myRow.Field<string>("name") )
select ;
I try something like above.
What i can see from your code is that you like to remove all rows where the field “Name” is empty. Is that correct?
The result you get back is not directly your new datatable. Instead you’ll get an
IEnumerable<DataRow>containing all the rows you’d like to see.Instead you could reverse the outcome of your linq query containing everything you don’t like and afterwards simply delete all this stuff from your datatable.