在LINQ to SQL C#中选择计数
本文关键字:选择 LINQ to SQL | 更新日期: 2023-09-27 17:58:56
如何使用COUNT将LINQ写入SQL?
示例:
var purch = from purchase in myBlaContext.purchases
select purchase;
我怎么能在这里计数?
就像
var purchCount = (from purchase in myBlaContext.purchases select purchase).Count();
甚至更容易
var purchCount = myBlaContext.purchases.Count();
您应该能够对purch变量进行计数:
purch.Count();
例如
var purch = from purchase in myBlaContext.purchases
select purchase;
purch.Count();