Hi,
I want to populate a dropdownlistwith information from my database, when a selection is made in another dropdownlist
this is the code I want to execute:
VB Code:
Dim myConnection As New OleDBConnection(ConnectionString) ' creates a dataset to store the information gained form the database Dim DsMembers As Dataset = New DataSet() Dim CommandText As String = "SELECT * from tbl_crews WHERE Name= '" & cbo_Crew.SelectedItem.Text & "'" Dim myAdapter As OleDBDataAdapter = New OleDBDataAdapter(CommandText, myConnection) myAdapter.Fill(DsMembers, "tbl_crews") Dim I as integer try For I = 0 To DsMembers.Tables(0).rows.count-1 Dim strtemp as String = DsMembers.tables(0).rows(I).item(0).tostring & " - " & _ DsMembers.tables(0).rows(I).item(1).tostring cbo_member.items.add(strtemp) Next I Catch ex as Exception lbl_Message.text = ex.ToString() Finally End Try
problem is that I don't know which command to put it under as it doesn't work on:
VB Code:
Sub cbo_Crew_SelectedIndexChanged(sender As Object, e As EventArgs)
and suggestions?
Thanks




Reply With Quote