gpt4 book ai didi

join - Entity Framework 加入

转载 作者:行者123 更新时间:2023-12-04 18:30:44 25 4
gpt4 key购买 nike

我使用的是 Entity Framework 4.0,但我的查询语法存在一些问题。我正在尝试连接 2 个表并同时传递一个参数来查找值。我想通过在表 1 中查找相关值来查找表 2 中的所有产品。

有人可以帮我解决语法问题吗?

提前致谢。

样本数据

表 1

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

表 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).Take(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));

关于join - Entity Framework 加入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6671688/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com