1
I would like to make a LINQ query that returns the amount of people who were born in the month.
In Mysql I do this query:
SELECT COUNT(*) AS DataNacimento FROM pessoas WHERE MONTH (DataNascimento) = '12';
At LINQ I tried to make this query, but does not accept:
var dataNascimento = db.Pessoas.Where(w => w.DataNascimento == "12").Count();
Here for me instead of Month, only these options appear: Equals, Gethashcode, Gettype, Getvalueordefault, Hasvalue, Tostring and Value.
– Rodrigo Santos
So there’s something wrong with your model, the problem is not with LINQ, you’re getting one
Nullable
and not aDateTime
as expected. Try to see if you haveValue
.– Maniero
That’s right, it was in "Summer Month".
– Rodrigo Santos