我写这个查询:
var query2 = (from p in behzad.Compare_closed_numbers_in_CRM_and_Billing_system_detail_counters
where p.fileid == point.id
select new
{
p.count
}).ToArray();
in count column have any value,and I want to sum all of the count value. For example:
我怎样才能植入它?谢谢。
如果计数字段是 int 尝试以下操作:
int sum = behzad.Compare_closed_numbers_in_CRM_and_Billing_system_detail_counters
.Where(t=>t.fileid == point.id)
.Select(t => t.Count ?? 0).Sum();
如果计数字段为nvarchar(max)
尝试这个:
int sum = behzad.Compare_closed_numbers_in_CRM_and_Billing_system_detail_counters
.Where(t=>t.fileid == point.id)
.Select(t => Convert.ToInt32(t.Count)).Sum();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)