0

My array A may be returns array of age likes

int [] A = {11,12,13}  or
int [] A = {14,15}     or   
int [] A = {11,14}

My Person table has column likes

ID    Name       Age
---------------------
1     John       12     
2     Michael    15
3     Tom        13
4     Owen       14

How can I get row from this table depend on my array's values using lambda ?

myASPGridView.DataSource = DBContext.Persons.Where(.....);

2 Answers 2

1

It should be something like that:

int [] A = {11,12,13};
myASPGridView.DataSource = DBContext.Persons.Where(p => A.Contains(p.Age));
0

Do you want this?

x => A.Contains(x.Age)

x denotes the input (in this case, your database row) and the function returns true where the array A contains x.Age.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.