• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 570
  • Last Modified:

combobox and duplicate items

hi..
I have a combobox that contains some items of one feild in database,,
some items are duplicate in that feild,
is there any method to remove the duplicate names in the combobox?
0
Jassimi
Asked:
Jassimi
  • 3
  • 2
1 Solution
 
TimCotteeCommented:
Hello Jassimi,

Easiest to remove the duplicates in the retrieval process from the database.

Using something like "Select Distinct MyField From MyTable" to eliminate duplicates before binding to the dropdown.

Regards,

TimCottee
0
 
JassimiAuthor Commented:
I don't want to remove it from the database..
I just want to remove it from the combobox
0
 
TimCotteeCommented:
Jassimi,

That doesn't remove it from the table, simply selects only distinct values. It has no effect on what is stored there, just the values that are bound to the dropdown.

TimCottee
0
 
JassimiAuthor Commented:
can you tell me how to that exactly,
because I connect this combobox through properties, I just chose the datasource and displaymember,

can I select the distinct values from properties,
tell me step by step
0
 
JassimiAuthor Commented:
ok..
I got the solution..
connect the combobox to the datasource from properties,
go to dataset designer from Solution Explorer
right click on the DataAdapter and choose configure..
you can adjust the SQL Statement or you can go to query builder to select the column that you want to make it Distinct
you can execute query to test that
after that click finish
All duplicate data will removed from the combobox
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now