1. Create the db connection 2. Create a command object 3. Set properties of the command object, including the connection object, sp name, etc. 4. Set any parameters required by the sp 5. Execute the sp, probably using the ExecuteReader method 6. Bind the data reader to the combo box
Sounds complicated, but it's really not. What database are you using? What parameters, if any, does the sp need?
i'm using sql 2000. The sp is a list of categories so it does not need any params.. I just don't know how to bind this to the combo box.. And yes iut does sound very complicated.. :-)
Not sure if you actually can bind to a DataReader in WindowsForms, use a DataTable (get a DataTable using the SqlDataAdapter [use it's .Fill Method])
As for DataBinding it, it's really easy, just set the .DataSource Property of the ComboBox to the DataTable. Then, (or before, shouldn't matter), set the .ValueMember and .DisplayMember Properties of the ComboBox to the fields you want to be the Value field and the Display field (respectively)
Also, check out the quickstarts at http://samples.gotdotnet.com/quickstart/winforms/ that have samples for binding a combobox and for filling your data from a database (check out the first grid sample for that).
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.