title: LINQ to DataTable Easy and Fast
body: <p>I am new to LINQ, I want to convert LINQ query to DataTable</p>
  
  <pre><code>    DataClassesDataContext db = new DataClassesDataContext(MyConncectionString);
      IEnumerable&lt;DataRow&gt; qry = (IEnumerable&lt;DataRow&gt;)(from tbl in db.Table1.AsEnumerable()
                                                       select tbl);
      DataTable dt=new DataTable();
      qry.CopyToDataTable(dt, LoadOption.OverwriteChanges);
      GridView1.DataSource = dt;
  </code></pre>
  
  <p>But I got error </p>
  
  <p><Blockquote>
  Unable to cast object of type 'WhereSelectEnumerableIterator to type 'System.Collections.Generic.IEnumerable`1[System.Data.DataRow]'.
  </Blockquote></p>
  
  <p>Can anyone please help me that </p>