簡體   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