I am using an SQLDataAdapter to bind information from a database table to a listbox. However, the user have to select an item from a dropdown list box, DropdownMovie before the information for that particular movie is bind to the listbox.
No errors in the codings. But when i run it, i got this error. What does it means and how i can solve it??
Server Error in '/WebApplication5' Application.
--------------------------------------------------------------------------------
An SqlParameter with ParameterName '@title' is not contained by this SqlParameterCollection.
Conn.Open()
Dim da As SqlDataAdapter = New SqlDataAdapter("Select SeatNum from Ticketing where MovieTitle = @title ", Conn)
da.SelectCommand.Parameters("@title").Value = DropDownMovie.SelectedValue
Dim ds As DataSet = New DataSet
' Fill DataSet with the data
da.Fill(ds, "Ticketing")
' Set DataSource property of ListBox as DataSet’s DefaultView
listbox_seatsbooked.DataSource = ds.Tables("Ticketing").DefaultView
listbox_seatsbooked.SelectedIndex = 0
' Set Field Name you want to get data from
listbox_seatsbooked.DataTextField = "SeatNum"
' Bind the data
Page.DataBind()
Conn.Close()
No errors in the codings. But when i run it, i got this error. What does it means and how i can solve it??
Server Error in '/WebApplication5' Application.
--------------------------------------------------------------------------------
An SqlParameter with ParameterName '@title' is not contained by this SqlParameterCollection.
Conn.Open()
Dim da As SqlDataAdapter = New SqlDataAdapter("Select SeatNum from Ticketing where MovieTitle = @title ", Conn)
da.SelectCommand.Parameters("@title").Value = DropDownMovie.SelectedValue
Dim ds As DataSet = New DataSet
' Fill DataSet with the data
da.Fill(ds, "Ticketing")
' Set DataSource property of ListBox as DataSet’s DefaultView
listbox_seatsbooked.DataSource = ds.Tables("Ticketing").DefaultView
listbox_seatsbooked.SelectedIndex = 0
' Set Field Name you want to get data from
listbox_seatsbooked.DataTextField = "SeatNum"
' Bind the data
Page.DataBind()
Conn.Close()