Advertisement

03.29.2008 at 05:49PM PDT, ID: 23280133
[x]
Attachment Details

LINQ Count rows in dataset with conditions

Asked by rdytmire in Language Integrated Query - LINQ, C# Programming Language

Tags: c#

Ok.. I've tried all the examples on MSDN and other sites but nothing seems to work.

I want to query a data table and find out how MANY rows match the selection criteria.  using LINQ to dataset and c# /.net 3.5.  How would I modify the query to return an int count.

Wrapping the whole select in a (...) refuses to work as it states the row type has no Count method.


var recordCount = from c in qADCMainDatabase.terrain_type_vs_unit_type_details.AsEnumerable()
                                       where ((c.terrain_type_name == terrainType) &
                                              (c.section_name == sectionName) &                                              
                                              (c.unit_type_name == unitTypeName))
                                       select c;
Start Free Trial
[+][-]03.29.2008 at 07:36PM PDT, ID: 21239313

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.29.2008 at 07:38PM PDT, ID: 21239323

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Language Integrated Query - LINQ, C# Programming Language
Tags: c#
Sign Up Now!
Solution Provided By: CMYScott
Participating Experts: 1
Solution Grade: B
 
 
[+][-]03.30.2008 at 03:19AM PDT, ID: 21240165

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.30.2008 at 08:00AM PDT, ID: 21240907

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.30.2008 at 12:44PM PDT, ID: 21241689

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.30.2008 at 03:11PM PDT, ID: 21242141

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 02:39AM PDT, ID: 21244131

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 04:38AM PDT, ID: 21244498

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 01:08PM PDT, ID: 21248688

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 01:31PM PDT, ID: 21248890

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 02:10PM PDT, ID: 21249233

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628