I have a database column that has several names separated by commas in each row. I'm trying to populate a data-table containing all the names but without duplicates.
Currently the list populates but duplicate names still appear.
My code is:
while (reader.Read())
{
string[] array = reader[0].ToString().Split(',');
string[] unique = array.Distinct().ToArray();
foreach (string s in unique)
dt.Rows.Add(s);
}
Any help would be greatly appreciated, thanks.