Hi,
I use a date and time picker to find transaction( From date & To date)
I am having the issue that not all the transaction are displaying because of the time portion of the dateandtime.
But what i need is simply to display all transactions of the dates between datefrom and Enddate regardless of the time.
And i need it in object format not string format.
this is what i use :
DateTime FromDate = DateTime.Now;
DateTime EndDate = DateTime.Now;
var Transaction = (from c in context.JobCards
where (c.TransDateRequired > FromDate) && (c.TransDateAdded < EndDate)
select c).ToList();
I Also tried to truncate the time
var Transaction = (from c in context.JobCards
where (EntityFunctions.TruncateTime(c.TransDateRequired) > EntityFunctions.TruncateTime(FromDate)) && (EntityFunctions.TruncateTime(c.TransDateRequired) < EntityFunctions.TruncateTime(EndDate))
select c);
With the truncate time i get following error
LINQ to Entities does not recognize the method 'System.Nullable`1[System.DateTime] TruncateTime(System.Nullable`1[System.DateTime])' method, and this method cannot be translated into a store expression<br />
thanks in advance for any help.