Advertisement

06.08.2007 at 10:15AM PDT, ID: 22622291
[x]
Attachment Details

VB.Net 2005: Datatable filter

Asked by k3n51mm in .NET, Miscellaneous Programming, Visual Studio .NET 2005

Tags: datatable, filter, 2005

I have a datatable that I need to filter. It's a rather complex filter though (for me anyway), and I'm having serious trouble getting my head around datacolumn filtering and all that. Note that i'm only doing this in VB because the database we must use (SQL Compact Edition) does not support the complex join/subquery required to get this data directly from the db.

Given the datatable:

NAME     RESULT         COMPVALUE
abcd         8                      6                                
efgh         3                       7                                
lmno         9                      2                                
abcd         4                      6                                
lmno         5                      2                                
efgh         4                       7                                
abcd         9                      6                              
                               
I need the following result set, preferably in a new datatable:
abcd         9                      6
efgh         4                       7
lmno         9                      2

For each NAME in the datatable, I need to return the highest RESULT and its COMPVALUE. COMPVALUE is a static value for each NAME and will always be the same.

Trying to break it down, I figured I'd need to get all the rows for each NAME, get the highest RESULT, grab the VALUE, and add it to the output datatable. But when I started looking at the datacolumn filtering docs on MSDN, I just can't understand it all at first glance. I have a deadline. Little help?



Start Free Trial
[+][-]06.08.2007 at 01:41PM PDT, ID: 19245370

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: .NET, Miscellaneous Programming, Visual Studio .NET 2005
Tags: datatable, filter, 2005
Sign Up Now!
Solution Provided By: pitster
Participating Experts: 1
Solution Grade: B
 
 
[+][-]06.08.2007 at 01:45PM PDT, ID: 19245392

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