简体   繁体   中英

Adding items to a combo box

I have a combo box that I want to bind with one column in my SQL database. This column is named "Type" and each row has a type. There are 10 Types total. This table has a total of 144 rows.

Now, when I bind the combo box to this column, I get 144 items in the combo box. So, instead of just getting the 10 types, I am getting each type however many times it shows up in that column. Is there a way to fix this? I have thought about hard coding the items into the combo box, but this might mess up when the user adds an item with a new "Type". Any help is appreciated. thanks

SELECT DISTINCT Type FROM TABLE;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM