DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Select Some Records From Datatable And Copy To Resultant Datatable Using LINQ
// The above query will fetch all the matching records for Id =1 from the datatable "test".
The "If" condition check the results and copies it to the datatable.
var query = from p in dsTest.Tables["test"].AsEnumerable()
where p.Field<string>("Id") == "1" select p;
if (query.Count<DataRow>() > 0) { dtTest = query.CopyToDataTable<DataRow>(); }
<a href="http://www.java-forums.org/java-software/"><strong>Java Software</strong></a>





