Populate ComboBox with a DataReader

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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).
 
Back
Top