0

i have two combobox and i have two database table in sql server 1st table name is Province and 2nd table name is City if i select province in my 1st combobox then show all cities against selected province show in the 2nd combobox when we click on combobox dropdown list so plz help me how i can do this in vb.net 2010

2
Contributors
2
Replies
10
Views
2 Years
Discussion Span
Last Post by Mian_4
0

Please post your codes , how far you write and describe your probs and exceptions what are you facing. Everyone in this forum always you to help, don't hesitate to post your Qse.

0

bro this is my code but this code can not be use to relationship for province and city so plz help me.
plz give me code if any body can do this relation
i have two combobox and i have two database table in sql server 1st table name is Province and 2nd table name is City if i select province in my 1st combobox then show all cities against selected province show in the 2nd combobox when we click on combobox dropdown list so plz help me how i can do this in vb.net 2010

If Province2.DataSource = "Punjab" Then

       Dim cmd As New SqlCommand("Select City from Table_9", nn)
        Dim da As New SqlDataAdapter(cmd)

       Dim dt As New DataTable()
        da.Fill(dt)

       If dt.Rows.Count > 0 Then
            ComboBox1.DataSource = dt
           ComboBox1.DisplayMember = "City"
        End If

    End If
    If Province2.DataSource = "Sindh" Then


    Dim cmd As New SqlCommand("Select City from Table_10", nn)
       Dim da As New SqlDataAdapter(cmd)

       Dim dt As New DataTable()
        da.Fill(dt)
        If dt.Rows.Count > 0 Then
            ComboBox1.DataSource = dt
            ComboBox1.DisplayMember = "City"
        End If
    End If  
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.