简体   繁体   中英

Get count of a datatable column contains with specific value

How to get the total of specific column contains with specific string drom datatable.

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. In that column I need the count of string "0".

尝试这个;

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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