Wrong data in dropdownlist

  • Thread starter Thread starter Frederik Vanderhaeghe
  • Start date 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
 
Hello

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

HTH.

Jon
 
Back
Top