Reputation: 8624
Why is this query returns 0 lines?
There is a record matching the arguments.
SomeDataContext db = new SomeDataContext(ConnString);
return db.Deafkaw.Where(p =>
(p.SomeDate1 >= aDate &&
p.SomeDate1 <= DateTime.Now) &&
(p.Year == aYear && p.IsSomething == false)
).ToList();
Am i missing something?
On the Table Deafkaw
SomeDate1 = 20/4/2010 11:32:17 Year = 2010 IsSomething = False
...besides other columns im not interested in conditions.
I need SomeDate1 between the dates i give IsSomething = False and Year = 2010.
Upvotes: 1
Views: 191
Reputation: 838106
You aren't assigning the result to anything so it is being discarded. Try this:
var results = db.Deafkaw.Where(p =>
(p.ImerominiaKataxorisis >= aDate &&
p.ImerominiaKataxorisis <= DateTime.Now) &&
(p.Year == etos && p.IsYpodeigma == false)
).ToList();
Update: you changed the question so now I'm not sure that this is the correct answer. Can you post the code where you call this method?
Upvotes: 3
Reputation: 8304
Use SQL profiler. Look at the sql query that is generated. Run the sql query manually and see if you get back any records.
Upvotes: 0
Reputation: 243041
It is difficult to answer your question without any additional information. Checking the following points may help you to find the problem:
Where
clause and write Deafkaw.ToList()
, what do you get?aDate
and etos
?DeaFkaw
data structure?Upvotes: 2
Reputation: 6659
Try
Deafkaw.Where(p => (p.ImerominiaKataxorisis >= aDate && p.ImerominiaKataxorisis <= DateTime.Now &&
p.Year == etos && p.IsYpodeigma == false)).ToList();
Upvotes: 0