c# - LINQ - using result from one in another -


i'm new linq, want rewrite of mine sql querys linq (just learn) , i'v stuck @ beginning. solution simple i'v said i'm new , didn't find solution this.

i have 1 query :

string typmoneta = textbox1.text; var moneta = x in db.grupytowarowes              x.typ == typmoneta              select new              {                  x.grupa              }; 

which works ok , when set

datagridview1.datasource = moneta; 

then got output

and want use output in second query :

var query = c in dbcontext.picking             c.number == 1000 && c.group == moneta             select new             {                 c.id             }; 

problem c.group == moneta. don't know correct syntax. me?

the moneta ienumerable<t> t in case type of grupa being said should write query below:

var query = c in dbcontext.picking             c.number == 1000              && moneta.contais(c.group)             select new             {                 c.id             }; 

or in fluent syntax below:

var query = dbcontext.picking                      .where(pick => pick.number == 1000                                   && moneta.contains(pick.group))                      .select(pick => pick.id); 

Comments