From SQL to combobox

TechnoTone

Well-known member
Joined
Jan 20, 2003
Messages
224
Location
UK - London
I have successfully connected to a SQL Server and executed a stored procedure. I now have an SqlDataReader with my data and I want to populate a combo-box. Is there a way to get the data to the combo-box without running through the records one-by-one?
 
I am unable to set the combobox.DataSource property to a SqlDataReader as it doesnt support either an IList or an IListSource interface.

Anyone else?
 
the way you have to do it is the following:

*use a dataadapter to bring the data
*fill a dataset with the data
*set the datasource property of the listbox to the correct dataset such as dataset1.table1
*set the display member to the field you want to display

and you are done. if have trouble creating the dataadapter on code use the wizard.

Best of Luck
 
Back
Top