繁体   English   中英

获取包含特定值的数据表列的计数

[英]Get count of a datatable column contains with specific value

如何获得特定列总数包含特定字符串drom数据表。

我跟随如下,但没有得到:

int count = _dt.AsEnumerable().Where(c => c.Field<string> 
("EffectiveShow").Equals("0")).count;

我的列名是“ EffectiveShow”。 在该列中,我需要计数字符串“ 0”。

尝试这个;

int count = _dt.AsEnumerable().Where(c => c["EffectiveShow"].ToString()=="0").ToList().Count;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM