Linq where dates question
-
Hi folks This expression works fine without the where clause: var someQuery = from some in context.OGsome where ((some.Due_Date >= some.Base_Date.Value.AddDays(-70)) && (some.Due_Date <= some.Base_Date.Value.AddDays(+70)) ) select some; I am trying to limit the query to between +/- 70 days. I keep getting an exception. Many thanks for any help resolving this. Mike
-
Hi folks This expression works fine without the where clause: var someQuery = from some in context.OGsome where ((some.Due_Date >= some.Base_Date.Value.AddDays(-70)) && (some.Due_Date <= some.Base_Date.Value.AddDays(+70)) ) select some; I am trying to limit the query to between +/- 70 days. I keep getting an exception. Many thanks for any help resolving this. Mike
What is the exception?
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
Hi folks This expression works fine without the where clause: var someQuery = from some in context.OGsome where ((some.Due_Date >= some.Base_Date.Value.AddDays(-70)) && (some.Due_Date <= some.Base_Date.Value.AddDays(+70)) ) select some; I am trying to limit the query to between +/- 70 days. I keep getting an exception. Many thanks for any help resolving this. Mike
-
Hi folks This expression works fine without the where clause: var someQuery = from some in context.OGsome where ((some.Due_Date >= some.Base_Date.Value.AddDays(-70)) && (some.Due_Date <= some.Base_Date.Value.AddDays(+70)) ) select some; I am trying to limit the query to between +/- 70 days. I keep getting an exception. Many thanks for any help resolving this. Mike
So it appears that
Due_Date
andBase_Date
are both columns in the DB (properties in the Entity object?) Why do you use the.Value
property withBase_Date
and not withDue_Date
? Are they both Nullable? What happens if either is null? (An exception? hint, hint) -
Hi folks This expression works fine without the where clause: var someQuery = from some in context.OGsome where ((some.Due_Date >= some.Base_Date.Value.AddDays(-70)) && (some.Due_Date <= some.Base_Date.Value.AddDays(+70)) ) select some; I am trying to limit the query to between +/- 70 days. I keep getting an exception. Many thanks for any help resolving this. Mike
So...did it get solved?