when i changed it nothing appeared in combo box2

Member Avatar for Unhnd_Exception

?

What is your table name and what are the column names in that table?

Which column name is Jake under?

table name is finaltickettable

fault_number, reported_date, fault_description, work_group, SubTeam, service_type, pl_number, fault_type, user, datetime

Member Avatar for Unhnd_Exception

I guess user is what your looking for.

Change to:

Command.CommandText = "Select Distinct user" & vbCrLf & _
                       "From finaltickettable" & vbCrLf & _
                       "Where Subteam = @SubTeam"[/code

And mark this thread as solved.

thank you so much Unhnd Exception!!!

please any body help me i can't view the data in the 2nd combo box

        Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
            myConnection = New SqlConnection(connectionstring)
            myConnection.Open()
            If TypeOf ComboBox1.SelectedItem Is String Then

                Dim Reader As SqlDataReader = Nothing
                Dim pc1 As String = ComboBox1.Text
                myCommand1 = New SqlCommand("SELECT Category" & vbCrLf & " FROM Product_Name_List " & vbCrLf & " where Category='" & pc1 & "'", myConnection)

                myCommand1.Parameters.AddWithValue(pc1, CStr(ComboBox1.SelectedItem))
                ComboBox2.BeginUpdate()
                ComboBox2.Items.Clear()
                Try
                    myConnection.Open()
                    Reader = myCommand.ExecuteReader
                    Do While Reader.Read
                        ComboBox2.Items.Add(CStr(Reader("P_Id")))
                    Loop
                Catch ex As Exception

                Finally

                    myConnection.Dispose()
                    myCommand.Dispose()
                    'dispose may not be available with sqldatareader
                    If Reader IsNot Nothing Then Reader.Dispose()
                End Try
                ComboBox2.EndUpdate()
            End If
        End Sub
    End Class

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.