Populate ComboBox with a DataReader

G

Guest

Is it possible to populate a ComboBox's DisplayMember and the ValueMember via a SqlDataReader in C#?

I know how to do it off of a dataset, but I would rather not incur the overhead since it is just a display field that is used to populate other information from the key value (ValueMember).

Larry
 
M

Mohamoss

Hi Lary

You can do it by looping through the data Reader and adding the items one
by one. But you can’t bind a control to data reader in windows apps since it
is a fast forward read only object. You can do that in webApps though.

Thanks ,


--
Mohamed Mossad
Microsoft GTSC Developer support for Middle East


Larry said:
Is it possible to populate a ComboBox's DisplayMember and the ValueMember via a SqlDataReader in C#?

I know how to do it off of a dataset, but I would rather not incur the
overhead since it is just a display field that is used to populate other
information from the key value (ValueMember).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top