Listbox Problem

prav_roy

Well-known member
Joined
Sep 10, 2005
Messages
70
Location
Mumbai
Programming Experience
1-3
hi,
i want to bind my list box with datareader

my code look like this


lst.DataSource = Dreader
lst.DisplayMember = "itemname"
lst.ValueMember = "itemno"

i get error saying
Complex databinding accepts as datasource either as IList or IListsource

but if i use dataset i dont get any error
 
You cant bind a listbox to a datareader. It's only for reading information into something. It works with a dataset/table because they hold information. You can only read the information from the datareader into the listbox item collection.
 
Back
Top