HI, I want to know how can I do the following:
1.- I have a database with different tables:
-employees (the "master table") it has empID, name and date of birth.
-address (empid, address, numer, etc etc)
-family (empid, name, date of birth, and family relation(mother, wife, etc))
-additional (empid, departament, date(of contract sing), date(of contract end)
as you can see they all have the empid field, and the relationship is with that field. the family table can have repeated empid cause it adds a record for each member of his/her family.
now, i have a new table where I have to add some fields from those tables
but i don't want to type the data again so, I want to make in my form, for example...
- a combobox1 with the empid from the employees table added as the items for that combobox
dim orow as datarow
For Each oRow In dsCodeTables.Tables("employees").Rows
combobox1.Items.Add(oRow("empid").ToString())
now, here comes the part that I can't do...
Now when I select the empid from the combobox, i want to fill another combobox2 with the NAME of the "family" table, but only the ones that have the same EMPID that the one in the combobox1
Also, do the same thing with the "address" table putting the address and number fields on textboxes (text1 and text2), but i want to put the ones that match the empid from the combobox1...
any help?
I was making an example using a textbox to put the empid, and, when pressing enter it showed something on another textbox:
Private Sub txtField1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtField1.KeyDown
Dim data As New r
Dim aux As Object
Dim aux2 As String
If e.KeyCode = 13 Then
aux = txtField1.Text
aux2 = "here I know I have to make a sql query like "SELECT * FROM family WHERE empid IS LIKE....."
txtField2.Text = aux2
End If
End Sub
I think thats how i have to do it, but i don't know how to make the sqlquery, or select the right empid, well, anythig...
Thanx for the help
1.- I have a database with different tables:
-employees (the "master table") it has empID, name and date of birth.
-address (empid, address, numer, etc etc)
-family (empid, name, date of birth, and family relation(mother, wife, etc))
-additional (empid, departament, date(of contract sing), date(of contract end)
as you can see they all have the empid field, and the relationship is with that field. the family table can have repeated empid cause it adds a record for each member of his/her family.
now, i have a new table where I have to add some fields from those tables
but i don't want to type the data again so, I want to make in my form, for example...
- a combobox1 with the empid from the employees table added as the items for that combobox
dim orow as datarow
For Each oRow In dsCodeTables.Tables("employees").Rows
combobox1.Items.Add(oRow("empid").ToString())
now, here comes the part that I can't do...
Now when I select the empid from the combobox, i want to fill another combobox2 with the NAME of the "family" table, but only the ones that have the same EMPID that the one in the combobox1
Also, do the same thing with the "address" table putting the address and number fields on textboxes (text1 and text2), but i want to put the ones that match the empid from the combobox1...
any help?
I was making an example using a textbox to put the empid, and, when pressing enter it showed something on another textbox:
Private Sub txtField1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtField1.KeyDown
Dim data As New r
Dim aux As Object
Dim aux2 As String
If e.KeyCode = 13 Then
aux = txtField1.Text
aux2 = "here I know I have to make a sql query like "SELECT * FROM family WHERE empid IS LIKE....."
txtField2.Text = aux2
End If
End Sub
I think thats how i have to do it, but i don't know how to make the sqlquery, or select the right empid, well, anythig...
Thanx for the help