sql到linq(方法表单) [英] sql to linq(method form)

查看:73
本文介绍了sql到linq(方法表单)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有sql查询

 选择 * 
来自 tbl_AccountHead
其中​​ AccountHeadId in
select AccountHeadID
来自 ACGroupACHead
其中 ACGroupID = 3



如何转换为linq(方法形式) )?

解决方案

检查此问题的解决方案

如何使用C#将sql查询转换为linq? [ ^ ]


< blockquote>试试这个:

  var  data = AccountHead.Where(a => a.ACGroupID!=  3 ); 





如需了解更多信息,请参阅: LINQ - 样本查询(101个样本) [ ^ ]

i have sql query

select *
from tbl_AccountHead
where AccountHeadId  not in (
    select AccountHeadID
    from ACGroupACHead
    where ACGroupID=3
)


how to convert into linq(method form)?

解决方案

Check the solutions of this question
how to convert sql query to linq using C#?[^]


Try this:

var data = AccountHead.Where(a=>a.ACGroupID!=3);



For further information, please see: LINQ - Sample Queries (101 samples)[^]


这篇关于sql到linq(方法表单)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆