arkiboys

I have populated a dataset with one table.
The data in the table looks as follows:
Index1Name Index2Name City Value
Indexk Indexk city1 2
Indexk Indexk city1 3
Indexk Indexd city1 2
Indexk Indexy city1 1
Indexy Indexk city1 1
Indexx Indexk city1
Indext Indexq city1 5
Indexs Indexs city1 6

Now I would like to have an array which gets populated from the distinct values in columns of Index1Name and Index2Name
So the array should contain something like:
Indexd Indexk Indexy Indexx Indext Indexs Indexq

Thanks



Re: .NET Framework Data Access and Storage distinct values in dataset

Steve Tighe

Hi

If you are using .net 2.0 then you can quickly create a dataview of column you are intrested in and the then use the ToTable method of the view to create a table filled with the distinct values. The performance of that would be directly related to the number of records present. If you are using .net 1.0 then you will need to loop the tablerows and populate your array, this will be slower because you will need to check for the existence of the value in your collection before you add it.

Hope that helps, sorry its a bit brief.

Cheers

Steve