title: Show in gridView Specific column of Table using Entity Framework 6.0
body: <p>What I want is this:</p>
  
  <pre><code>DataTable dt=mystaticClass.gettableFuction("select col1,col2,col3,col4 from table1 where date between (date1 and date2) and  id=(select max(id) from table1)");
  </code></pre>
  
  <p>Now I want my data-table to be filled using linq expression.I tried this.</p>
  
  <pre><code> lamiEntities1 lam = new lamiEntities1();
      var pay = from p in lam.Mytablename.AsEnumerable()
                where p.Date &gt; start &amp;&amp; p.Date &lt; end
                select new
                {
                    Column1 = p.col1,
                    Column2 = p.col2
                    Column3 = p.col2
                    Column4 = p.col2
                };
  </code></pre>
  
  <p>Here is don't know how to call max function to get record of <code>max(Id)</code></p>
  
  <pre><code>grid1.datasource = pay;
  </code></pre>
  
  <p>Here I'm getting only one column1 value, not entire row with 4 columns</p>
  
  <p>If I remove</p>
  
  <pre><code>   select new
            {
                Column1 = p.col1,
                Column2 = p.col2
                Column3 = p.col2
                Column4 = p.col2
            };
  </code></pre>
  
  <p>and change it to </p>
  
  <pre><code> select p;
  </code></pre>
  
  <p>I get all unwanted columns including my 4 columns.</p>
  
  <p>I'm using Mysql and Entity Framework 6.1.3.</p>