Answer the question
In order to leave comments, you need to log in
How to show data in a table after a certain date?
This is the error that pops up for me.
An unhandled exception of type 'System.NotSupportedException' occurred.
in EntityFramework.SqlServer.dll
Additional information: The specified type member 'Date' is not
supported in LINQ to Entities. Only initializers, entity members, and
entity navigation properties are supported
private void OnActive(object sender, RoutedEventArgs e)
{
DateTime TodayDate = DateTime.Now.Date; // init
var query = from RentCarDB in this.dbContext.RentCarDBSet
where RentCarDB.StartDate.Date <= TodayDate
orderby RentCarDB.StartDate
select RentCarDB;
this.rentCarDBViewSource.Source = query.ToList();
}
Answer the question
In order to leave comments, you need to log in
If anyone is interested, I added
And changed the line from
to
where DbFunctions.TruncateTime(RentCarDB.StartDate) <= TodayDate
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question