Solved

DataTable.Select() method

Posted on 2004-04-04
2
1,364 Views
Last Modified: 2007-12-19
I have a datatable with a column named desc1. desc1 is not unique, but I would like to return an array of datarows using the select method. I've used this select expression

"desc1 = 'something'"

But that returns all the rows that have desc1 = 'something', but I want only the rows with distinct values for desc1.

like, a select distinct statement.

Is there any way to do this in the filter expression?
0
Comment
Question by:gregasm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Expert Comment

by:DonRameshSachin
ID: 10755067
Hi,
 DataTable.Select, method can handle only Expression , sorting and DataviewRowstates. U cannot use  this Select method to obtain distinct values in a batch of records.  Probably wht  u can do is that loop through The Datatable and remove the duplicated values. But the best way is to do that before filling the Datatable. I.e., change the query which u have used to fill up the datatable in such a way that select distinct values

Don
0
 
LVL 28

Accepted Solution

by:
mmarinov earned 500 total points
ID: 10755381
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question