Solved

DataTable.Select() method

Posted on 2004-04-04
2
1,360 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
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now