in my asp.net+vb+accessdatabase web. ihave the following code to display data in gridview.
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
Dim AccessDataSource1 As New AccessDataSource
AccessDataSource1.ID = "AccessDataSource1"
Me.Page.Controls.Add(AccessDataSource1)
AccessDataSource1.DataFile = System.Configuration.ConfigurationManager.AppSettings("baijuep")
AccessDataSource1.SelectCommand = "SELECT kNO, name, company from pers where company=?"
AccessDataSource1.SelectParameters.Add("company ", DropDownList1.SelectedValue)
GridView1.DataSourceID = "AccessDataSource1"
GridView1.DataBind()
End Sub
But it gives error as under
The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource. A control with ID 'AccessDataSource1' could not be found.