I have a Linq query that returns type var myQry
var myQry = from .....
This big linq returns all the records that I need to filter on. In one of my if conditions, I have a filter that works to check the date. I need to check if the name contains the entered name and exactly matches the date of birth.
I tried this by compiling and executing, but failed
myQry.Where(x => x.FirstName.Contains(strName) && DateTime.Compare( x.BirthDt, searchDt)>=0).ToList()
Then I tried this, which gave an exception. "The arguments to DbArithmeticExpression must be of a numeric common type."
myQry.Where(x => x.FirstName.Contains(strName) && (x.BirthDt- searchDt).Days == 0).ToList();
For such a situation, when I use the where clause in my query, what would be the best way to do a date comparison? What operations are not allowed in the where clause of the LinQ query?
Thank you for your time...
source share