Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to know the count of specific strings present in the datatable

C#
var Contact = (from DataRow dr in dtRec.Rows
                                         where dr["Recommendations"] == strContactVibration
                                         select dr).ToList();


but i am getting count as 0 where i am doing wrong?
Posted
Updated 21-Oct-14 1:48am
v3

1 solution

Use Tostring ,it should work like


SQL
var Contact = (from DataRow dr in table.Rows
                       where dr[Recommendations].ToString() == "m"
                       select dr).ToList();
 
Share this answer
 
Comments
chandra sekhar 21-Oct-14 8:54am    
Thanks that worked.
Mukesh Ghosh 22-Oct-14 0:13am    
Hi 5 :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900