title: Linq - between dates query
body: <p>I am trying to convert the following sql query as a linq query, however I keep experiencing an error - </p>
  
  <blockquote>
    <p>Operator '&lt;=' cannot be applied to operands of type 'string' and 'System.DateTime'.  </p>
  </blockquote>
  
  <p><strong>SQL Query:</strong></p>
  
  <pre><code>select top 3 Deal, [property], [event], [Date] from [dbo]. [Database_CRE_Events] 
  where (convert(datetime,[Date],103) between '01-May-2015' and '15-May-2015')  and [property] is not NULL 
  order by convert(datetime,[Date],103) desc
  </code></pre>
  
  <p>I believe this is happening because <code>c.Date</code> is a string field from the entity database.  I have tried converting the date values to string and datetime to get the following to work, but I keep getting an operand error. </p>
  
  <p><strong>LINQ Query:</strong></p>
  
  <pre><code>        DateTime dat = DateTime.Now.AddDays(-10);
          string preWeek = dat.ToString("dd-MMM-yyyy");
  
          DateTime dtt = DateTime.Now;
          string today = dat.ToString("dd-MMM-yyyy");
  
          var data = db.Database_CRE_Events.Where(c =&gt; c.Date &lt;= Convert.ToDateTime(preWeek) &amp;&amp; c.property != null)
                        .Select(x =&gt; new Loan() { Name = x.Deal, loan = x.property, evnt = x.Event })
                        .ToList().Take(3);
          return data;
  </code></pre>
  
  <p>Is it possible to convert the original sql query to a linq query as <code>c.Date</code> being a string parameter?</p>
  
  <p>Thank you for any further assistance. </p>