<分区>
您好,我正在尝试使用 Linq 将此代码从 SQL 转换为 C#
SQL代码是这样的:
SELECT N.Name,N.Unit,N.Typee,ID,NOTE
FROM Table_A N join Table_B A on (N.ID = A.ID)
join NotasQL G on ((N.Not1 = G.CODE) or (N.Not2 = G.CODE) )
join Attributes X on (A.AppID= X.AppID)
此代码在 SQL 中运行良好并获得预期结果,但当我尝试在 C# 上复制此代码时,我不知道如何执行 OR 部分,这就是我目前所拥有的:
var Select = (from A in context.Table_A
from B in context.Table_B
from E in context.NotasQLs
from D in context.Attributes
where (String.Compare(A.ID, B.ID, true) == 0 &&
String.Compare(B.AppID, D.AppID, true) == 0
&&
(String.Compare(A.Not1, E.CODE, true) == 0 ||
String.Compare(A.Not2, E.CODE, true) == 0))
我的应用程序运行时已过期,因为查询没有选择任何内容,如果我删除了 or 条件运行但我需要 OR。