PDA

Click to See Complete Forum and Search --> : how to fill a combobox with databasefields


newbiekea
Jan 27th, 2002, 06:28 AM
how do you fill a combobox with databasefields?

TheReverend
Feb 1st, 2002, 12:54 PM
This is how i did it sucking data from SQlServer 2000

In a windows application you would create a dataset (ds)
create a sqldataadapter (da)
then set the DataSource of your combo box to the content you want(eg ds.TypeValue)
- DisplayMember to the value
- ValueMember to the same value.
- Also set the DropDownStyle to DropDownList.

then in code (on button_click, FormLoad etc)

ds.Clear()
da.Fill(ds, "TypeValue")

where typevalue is the column from the table you are accessing in the dataset

sorry if it seems badly explained but i am just learning myself