I have a logging table that lists all of the updates our customers receives. In the column, the company code can be listed several times. I need to get a list of all available codes in the list but only show them once.
Here is my column:
I'd like to query the column and only return:
DEM
FRK
And not:
DEM
DEM
DEM
FRK
I can query the list as such:
private void PopulateCompanyCodes()
{
var entity = new SuburbanWebServiceEntities();
var qry = from x in entity.UpdateLogs
select x.CompanyCode;
comboBox_CompanyCodes.Items.Add(string.Empty);
foreach (var cc in qry.ToList())
{
comboBox_CompanyCodes.Items.Add(cc);
}
comboBox_CompanyCodes.Text = string.Empty;
}
But of course, I'm getting DEM listed several times:
Is there a way to get the first list, only showing each item once for a combobox?
Thank you!