title: convert a string to datetime in LinqToEntities (inside the query)
body: <p>I have a date in the string format in a table and I need to compare it with the parameter to retrieve all rows that match with the given date. how can I do this? I can't use DateTime.Parse and Convert.ToDateTime. both of them are not supported (I get an error). Is this possible at all in Linq OR do I have to write a stored procedure for it due to this limitation?</p>
  
  <p>Note: I can't change the datatype of the column from varchar to DateTime, because that column contains other values as well, not just dates. it is a generic table and the column may contain different types of values based on the values in other columns. changing this design is outside the scope of this question.</p>
  
  <p>sample code ("x" is the date parameter passed into this method):</p>
  
  <pre><code>    from t1 in Table1
      where EntityFunctions.DiffDays(DateTime.Parse(t1.Value),x) == 0
      select new {t1.Col1, t1.Col2};
  </code></pre>
  
  <p>Update: if I use DateTime.Parse, I get the error "LINQ to Entities does not recognize the method 'System.DateTime Parse(System.String)' method, and this method cannot be translated into a store expression." similar error for Convert.ToDateTime as well.</p>