need help populating a listbox from a database on a webform

  • Thread starter Thread starter cloverme
  • Start date Start date
C

cloverme

Hi,

I need help populating a listbox from a database on a webform.

I created a an access database with a table, fields and data. Then I
created a WebForm in vb.net and added a DropDownList control to the
page.

Then I created a data connection to my table... I right clicked and
told it to generate a dataset (which it created dataset1).

On the control, I set the properties as follows: Datasource (to
dataset1), Datamember (to the table in the database), and
DataTextField (to the field that has the data to populate the list
box). When I choose the tables and fields, it populates with the
table name and field names, so I know it's seeing the database.

However, when I run the app, the DropDownList does not populate with
any data, it's blank.

Any help would be appreciated.

Thanks,
-Chris
 
Hi Cloverme.

It is always a guess without code but I think I am very much near it.
On the control, I set the properties as follows: Datasource (to
dataset1), Datamember (to the table in the database), and

datasource dataset1.table(0)
DataTextField the column to display
DataValueField the column you want to use when selected

I hope this helps

Cor
 
Back
Top