Link to home
Start Free TrialLog in
Avatar of gregasm
gregasm

asked on

DataTable.Select() method

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?
Avatar of DonRameshSachin
DonRameshSachin
Flag of United States of America image

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
ASKER CERTIFIED SOLUTION
Avatar of mmarinov
mmarinov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial