[英]Get count of a datatable column contains with specific value
How to get the total of specific column contains with specific string drom datatable. 如何获得特定列总数包含特定字符串drom数据表。
I followed as like below but not getting : 我跟随如下,但没有得到:
int count = _dt.AsEnumerable().Where(c => c.Field<string>
("EffectiveShow").Equals("0")).count;
There "EffectiveShow" is my column name. 我的列名是“ EffectiveShow”。 In that column I need the count of string "0". 在该列中,我需要计数字符串“ 0”。
尝试这个;
int count = _dt.AsEnumerable().Where(c => c["EffectiveShow"].ToString()=="0").ToList().Count;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.