作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何使用带有 Entity Framework 的 LINQ 在 where 条件下使用“不等于”。
public ActionResult ViewOfficeType()
{
return View(entity.TBL_OFFICETYPE.Where(p => p.STATUS<>"D").ToList());
}
it shows invalid expression '>'
如果我使用 '!='。它不会显示错误。但它不起作用。
最佳答案
您可以在 Equals()
上使用 !
运算符
public ActionResult ViewOfficeType()
{
return View(entity.TBL_OFFICETYPE.Where(p => !p.Equals("D")).ToList());
}
关于entity-framework - 如何在 Entity Framework 中使用linq在where条件下使用 "not equal to",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50128116/
我是一名优秀的程序员,十分优秀!