开发者

Entity framework joins

I'm using the entity framework 4.0 and I'm having some issues with the syntax of my query. I'm trying to join 2 tables and pass a parameter to find the value at the same time.I would like find all of the products in table 2 by finding the correlating value in table 1.

Can someone help me out with syntax please?

Thanks in advance.

sample data

table 1

ID  productID   categoryID  
361 571         16  
362 572         17  
363 573         16  
364 574         19  
365 575         26

table 2

productID   productCode

571     sku

572     sku

573     sku

574     sku

575     sku 




var q = from i in context.table1
                            from it in context.table2
                            join <not sure> 
                            where i.categoryID == it.categoryID and < parameter >
                          select e).Skip(value).T开发者_开发百科ake(value));

                    foreach (var g in q)
                    {
                        Response.Write(g.productID);
                    }


var q = from i in context.table1
        join it in context.table2 on i.productID equals it.productID
        where i.categoryID == it.categoryID and it.productCode = xyz
      select i).Skip(value).Take(value));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜