|
-
Sep 27th, 2007, 09:25 AM
#1
Thread Starter
Addicted Member
[2005] Distinct values in DataTable
Hi,
I'm looking for a very quick method of determing distinct values in a DataTable.
The application is streamreading a text file, and populates a table.
The table could end up being huge, and so this can have an adverse effect on performance, so I'm looking to implement the fastest possible method of getting the distinct ProductIDs from the table.
Looping through the table and putting the ProductID values into an array, and then checking to see if the value is contained within the array before adding a new value seems to be fairly good.
Sorting the table in a DataView and looping through seems slower.
I've come across a page on MSDN which seems old-ish.
Are there any other solutions that I could consider? I'd like to think that I could do something "at source", and so when the data is read in, and stuffed into a DataRow, do something with it at that point?
Any suggestions would be appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|