Cannot seem to populate second dropdownlist !!!!

P

Patrik

Hi,

I don't know why, it seems simple enough, but this code below doesn't
populate my second dropdownlist. First one populates just fine. Here's
the rest of the code. I'm using Web Matrix

Thank you for the advice.


Function PossibleQuestionnaire(ByVal num_Département As String) As
System.Data.DataSet
Dim connectionString As String = "server=...
Dim dbConnection As ...
Dim queryString As String = "SELECT ... .. WHERE Departement =
@Num_Département)"
Dim dbCommand As System.Data.IDbCommand = New
System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
Dim dbParam_num_Département As ...
dbParam_num_Département.ParameterName = "@Num_Département"
dbParam_num_Département.Value = num_Département
dbParam_num_Département.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_num_Département)
Dim dataAdapter As System.Data..
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function


Sub DropDownList1_SelectedIndexChanged(sender As Object, e As
EventArgs)
Dim number as Integer
number = DropDownList1.SelectedItem.Value
DropDownList2.DataTextField = "Num_Questionnaire"
DropDownList2.DataSource =
PossibleQuestionnaire(DropDownList1.Items(DropDownList1.SelectedIndex).text)
DropDownList2.DataBind()
End Sub
 

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,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top