Wrong data in dropdownlist

  • Thread starter Frederik Vanderhaeghe
  • Start date
F

Frederik Vanderhaeghe

Hi,

I want to get values out of the database into a dropdownlist, but when I run
my form, I get one value: 'system.data.datarow'

My code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Not Page.IsPostBack Then

Dim strSQLJaar As String = "select distinct year(Datum) as jaar from
TBL_Stat_Sites"

connectie.Open()

Dim daJaar As New SqlClient.SqlDataAdapter(strSQLJaar, connectie)

daJaar.Fill(ds, "jaren")

ddlJaar.DataSource = ds.Tables("jaren")

ddlJaar.DataBind()

End If


End Sub
 
G

Guest

Hello

You'll need to set the DataTextField and DataValueFiend on the dropdownlist.

HTH.

Jon
 

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

Members online

No members online now.

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top