Click here to Skip to main content
15,905,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a dataset named
dataSetforReportFilter 


This Dataset has only one table. This is like
dataSetforReportFilter.Tables[0]


This table has few columns. The name of one column is
'Root'

and datatype nvarchar OR string.

I want to filter this dataset where the value of Root=id. Here id is a variable.

Can anyone help me providing a LINQ expression for that ?
Posted
Updated 16-Jun-14 19:52pm
v2

1 solution

XML
var query = from r in dataSetforReportFilter.AsEnumerable()
            where r.Field<string>("Root") == id
            select r;

DataTable newDT = query.CopyToDataTable();
 
Share this answer
 
Comments
sachi Dash 17-Jun-14 2:27am    
Thanks a lot !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900