Question Linq Query

pumus

New member
Joined
Jul 2, 2022
Messages
1
Programming Experience
Beginner
Hi

I have value in textbox 7. What should be the linq query

From TO

2 4

5 7

8 10

Record 2 should be returned


C#:
var Result = (from t in context.Groups
                          where t.FromAge >= Age && t.ToAge <= Age
                          select t.ID).FirstOrDefault();
 
What's wrong with your current query?
 
How about you provide an explanation of what you're trying to achieve? An example is fine but there are countless ways to achieve one specific result from one specific example. If you're going to write code then you need to know the exact logic the code needs to implement, so you have to know the rules for getting the desired output from any input. If you know what that logic is then you can describe it in detail to us. If you don't know what it is then you shouldn't even be writing any code yet. The logic part has nothing to do with programming, because it's the same logic that you'd use to do the whole thing manually, so you don't need any programming experience to come up with the logic. So, what logic are you trying to implement?
 
Back
Top Bottom