Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all
code for finding the table is empty oe there is any value using linq
Posted
Comments
Abdul Quader Mamun 9-Dec-10 9:35am    
Correct Spelling & describe question.

Why do you need linq here?
myTable.Rows.Count would tell you if it is empty or not.
 
Share this answer
 
Comments
Sandeep Mewara 9-Dec-10 10:53am    
Can anyone explain me a little whats wrong with my answer? :)
Sandesh M Patil 10-Dec-10 5:40am    
correct answer
I will give an example see below

DataTable dt = CustomerDataHelper.GetCustomers ();

if(dt.Rows.count>0)
{
  var nycCustomer = from dr in dt.AsEnumerable ()                  
                  where (dr.Field<string> ("City") == "New York")         && (dr.Field<int>("CustomerID") > 100)};
}
 
Share this answer
 

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