gpt4 book ai didi

c# - LINQ to SQL 对字符串执行 OR

转载 作者:太空宇宙 更新时间:2023-11-03 18:48:33 24 4
gpt4 key购买 nike

我只是想执行 LINQ 查询以返回明年将运行的一组类(class) ID 和类(class)名称。作为其中的一部分,我需要执行 OR 查询,因为我也希望返回与明年相关的数据,这些数据作为字符串保存在我的数据库中,这是我遇到的唯一问题,所以任何帮助都是赞赏。

var result = (
from a in Offering
join b in Courseinfo on a.CourseID equals b.CourseID
into temp
from c in temp
where c.Year == "10/11" || "11/12"
select new { c.CourseID, c.CourseTitle }).DefaultIfEmpty();

最佳答案

将您的查询重写为 where c.Year == "10/11"|| c.Year == "11/12".

关于c# - LINQ to SQL 对字符串执行 OR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2092584/

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