Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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?

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

Posted

I am unable to set the combobox.DataSource property to a SqlDataReader as it doesn't support either an IList or an IListSource interface.

 

Anyone else?

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

Posted

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

You're either a one or a zero. Alive or dead.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...