Rohit Sharma

Rohit Sharma

  • NA
  • 100
  • 44.6k

How to filter datatable

Nov 29 2012 7:08 AM
Helle sir/madam

i want to filter datatable. for that i am using  linq in this way its not working its give an error " The source contains no DataRows."


first i get a value in a datatable dt.
now i am using Linq
 var query = from r in dt.AsEnumerable()
                                            where r.Field<string>("AI_No_Of_Conception") == ""
                                                            select r;
 DataTable   dtLink=new DataTable();
                            dtLink = query.CopyToDataTable();

if any another option how to apply a query on datatable and bind it another Datatable then please suggest my.


Answers (6)