I need to compare the date only those that are in the month of the system and for this I make the following query:
var lstConcepto = (from m in context.SMT_CONCEPTOBASICO
where m.CODIGOENTIDAD.Contains(getCodEntidad)
&& m.FECHAINICIAL == ConceptoTo.FechaInicial
&& m.FECHASISTEMA == ConceptoTo.FechaSistema.Month
&& !m.VALORALFANUMERICO.Contains("Total")
select m).ToList();
I can't find a way to make m.SYSTEMDATE.MONTH the date of the object.
&& m.DATESYSTEM == ConceptTo.DateSystem.Month Here I get an error comparing datetime and int... how do I convert m.DATESYSTEM In month??
UPDATE the option of m.SYSTEMDATE.Month throws error as indicated in the image
The problem is that SYSTEMDATE is of type
Nullable
. That's why in the error it appears asDateTime?
with the?
at the end.To read the value you must do it like this:
C# Nullable Reference
Update:
Create a variable and store the date value there to use in the query:
Whenever you can
m.FECHASISTEMA
makeDateTime
the comparison in the following waySo yes, your code should be