I have problems with populating a datalist from my dataset. When I try it with a datagrid, everything seems to work fine but the datalist wont populate.
I have a wizard created connection, adapter and dataset.
The code:
Then calling it from the page load:
I have a wizard created connection, adapter and dataset.
The code:
Visual Basic:
Private Sub BindList()
SqlDataAdapter1.SelectCommand.CommandText = "SELECT * FROM mailinglist WHERE Firstname = 'nick'"
SqlDataAdapter1.Fill(DataSet11, "mailinglist")
DataList1.DataSource = DataSet11
DataList1.DataMember = "mailinglist"
DataList1.DataBind()
End Sub
Then calling it from the page load:
Visual Basic:
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
BindList()
Label5.Text = SqlDataAdapter1.SelectCommand.CommandText
End Sub