title: LINQ to Entities does not recognize the method 'System.DateTime ToDateTime(System.String)'
body: <p>I have a column TG003 to store date which is a string.</p>
  
  <p>And I want to list data for the past seven days </p>
  
  <p>Below is what I have done and I'm having errors:</p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'System.DateTime ToDateTime(System.String)' method, and this method cannot be translated into a store expression.</p>
  </blockquote>
  
  <pre><code>public List&lt;CCOPTG&gt; listrecentCCOPTG()
  {
      string startdate = DateTime.Today.AddDays(-7).ToString("yyyyMMdd");
      string enddate = DateTime.Now.ToString("yyyyMMdd");
      return db.CCOPTG.Where(p =&gt; Convert.ToDateTime(p.TG003)&gt;=Convert.ToDateTime(startdate) &amp;&amp; Convert.ToDateTime(p.TG003) &lt;= Convert.ToDateTime(enddate)).OrderByDescending(p=&gt;p.TG003).ToList();
  }
  </code></pre>
  
  <p>Please advise.</p>