Hello All,
If you want some records from data table and move them to a resultant datatable then use the following LINQ query.
var query = from p in dsXML.Tables["TargetCompound"].AsEnumerable()
where p.Field<string>("CompoundId") == "1" && p.Field<string>("SampleId") == "1"
select p;
if (query.Count<DataRow>() > 0)
{
dtIstdCompund = query.CopyToDataTable<DataRow>();
}
The above query will fetch all the matching records for compoundId =1 and sampleId = 1 from the datatable "TargetCompound".
The "If" condition check the results and copies it to the datatable.
Hope it helps.