【发布时间】:2017-06-15 07:25:08
【问题描述】:
如何获取包含特定字符串 drom 数据表的特定列的总数。
我如下所示,但没有得到:
int count = _dt.AsEnumerable().Where(c => c.Field<string>
("EffectiveShow").Equals("0")).count;
“EffectiveShow”是我的栏目名称。在该列中,我需要字符串“0”的计数。
【问题讨论】:
如何获取包含特定字符串 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;
【讨论】:
.Count()即可。