G
Guest
This is getting very frustrating. I placed the same question before twice and
got no response. Hopefully I'll get one this time.
What I want to do is to restrict the items in one of the cbo boxes in my
windows form based on what is selected in another cbo box.
Example: When I choose "George" from the cbo box that shows the clients last
names, I want when I click on the cbo box that shows the first names to see
only the first names who have "George" as their last name.
What is the syntax for that?????
The code I used to open a connection to the SQL database where the data in
the two cbo boxes is generated from is as follows:-
Private Sub ConnectSQL_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ConnectSQL.Click
Dim SQLEV As SqlClient.SqlConnection = New SqlClient.SqlConnection()
Dim cmd As SqlClient.SqlCommand
Dim ClientName As SqlClient.SqlDataReader
SQLEV.ConnectionString = "Persist Security Info=true;Integrated
Security=false;User ID=sa;Password=xxxx;database=yyyy;server=zzzz"
SQLEV.Open()
cmd = New SqlClient.SqlCommand("SELECT * FROM qmf_cint", SQLEV)
ClientName = cmd.ExecuteReader
cbo_ChildLName.Items.Clear()
cbo_ChildFName.Items.Clear()
Do While ClientName.Read
cbo_ChildLName.Items.Add(Trim(ClientName.Item("Last_Name").ToString))
cbo_ChildFName.Items.Add(Trim(ClientName.Item("First_Name").ToString))
Loop
SQLEV.Close()
End Sub
got no response. Hopefully I'll get one this time.
What I want to do is to restrict the items in one of the cbo boxes in my
windows form based on what is selected in another cbo box.
Example: When I choose "George" from the cbo box that shows the clients last
names, I want when I click on the cbo box that shows the first names to see
only the first names who have "George" as their last name.
What is the syntax for that?????
The code I used to open a connection to the SQL database where the data in
the two cbo boxes is generated from is as follows:-
Private Sub ConnectSQL_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ConnectSQL.Click
Dim SQLEV As SqlClient.SqlConnection = New SqlClient.SqlConnection()
Dim cmd As SqlClient.SqlCommand
Dim ClientName As SqlClient.SqlDataReader
SQLEV.ConnectionString = "Persist Security Info=true;Integrated
Security=false;User ID=sa;Password=xxxx;database=yyyy;server=zzzz"
SQLEV.Open()
cmd = New SqlClient.SqlCommand("SELECT * FROM qmf_cint", SQLEV)
ClientName = cmd.ExecuteReader
cbo_ChildLName.Items.Clear()
cbo_ChildFName.Items.Clear()
Do While ClientName.Read
cbo_ChildLName.Items.Add(Trim(ClientName.Item("Last_Name").ToString))
cbo_ChildFName.Items.Add(Trim(ClientName.Item("First_Name").ToString))
Loop
SQLEV.Close()
End Sub