select column from dataset using LINQ -
I'm completely new to the linq query, please help with this query, fields in the dataset are:
Name value on client_.
I want to select the value if name == "searchtext"
DataTable results = (in D ( Dataset) _MyDetetset Tables ["Records"]. AsEnumerable () order from D.Field & lt; string & gt; ("name") ascending where D ["name"]. ToString (). ToLower (). Include (ProjectName.ToLower ()) Choose D ?? CopyToDataTable ();
.var query = (_MyDataset.Tables in D ["Records" ] .Unimitable () where d.Field & lt; string & gt; ("name"). Equals ("searchText", string compiler.content culture ignor seas) D). Orderbie (x = & gt; x.field & lt; string & gt; ("name")); If (query.Count ()! = 0) {DataTable result = query.CopyToDataTable (); }
If _MyDataSet is a dataset object, additional cast is not required in your example.
Then create an extension method to create a filtered data table:
Then you can filter your statistics like this:
Results. Return column (new list & lt; string & gt; {"value"});
will return a data table with only the column "value"
Comments
Post a Comment