本文介绍了如何在linq quary中使用sql quary的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在linq中使用sql quary



how to use sql quary in linq

select * from AcoTransaction where AcoTransactionTypeId IN (8,11,18,26,1,14,17,25,27,30,5,6,7,20,21,22,12,13,19,24)





in lin q quary不工作





in linq the quary is not working

acoTransaction = (DcAccountOperation.GetTable<AcoTransaction>()).Where(
                        p => (p.AcoTransactionTypeId in(8,11,18,26,1,14,17,25,27,30,5,6,7,20,21,22,12,13,19,24)).ToList();

推荐答案


List<int> input = new List<int>() { 8, 11, 18, 26, 1, 14, 17, 25, 27, 30, 5, 6, 7, 20, 21, 22, 12, 13, 19, 24 };

List<int> source = new List<int>() { 8, 11, 18, 26, 1, 14, 17, 25, 27, 30, 5, 6, 7, 20, 21, 22, 12, 13, 19, 24 };

 var acoTransaction = source.Where(p => input.Contains(p) ).ToList();


这篇关于如何在linq quary中使用sql quary的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 16:24