Solved

DataTable.Select() method

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

839 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