|
-
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.
-
Sep 27th, 2007, 11:10 AM
#2
Re: [2005] Distinct values in DataTable
I'd actually give that MSDN article a shot. I imagine that would be better suited to searching for your distinct values rather than using an Array.
Good luck.
-
Sep 28th, 2007, 03:24 AM
#3
Thread Starter
Addicted Member
Re: [2005] Distinct values in DataTable
Yeah - I'll give it a try - but was hoping for something clever that didn't have to loop through the data.
Thanks anyway.
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
|