I have a string 31-10-2014 wich i want to compare with a value in the database.
public ActionResult SearchResult(string searchDate)
{
var bookings = from m in db.Bookings
select m;
if (!String.IsNullOrEmpty(searchDate))
{
bookings = bookings.Where(s => s.Date1.CompareTo( DateTime.ParseExact(searchDate, "dd-mm-yyyy", CultureInfo.InvariantCulture)) >= 0);
}
return View(bookings);
}
the comparing keeps failing, How should i compare an input date to a database value (i left the try catch for validating the input to be an dattime so the example is more clear)
I get the message (even without searchData):
Linq doesn't recognise ParseExact method.