Get Auto Foreign Key value
I am trying to do a generalized basic search for my MS-SQL data. Let me explain what I have done so far:
- First, I fill in one field with all the table names.
- Then fill in the second combo box with the columns of the selected table from the first combo box.
I am running a generic database query for example select * from combobox1.text where combobox2.text='someValue'
. Everything works fine for me, but I cannot get foreign key data that is primary in another table.
What I need
suppose Table A has columns: 1 primary key, 2 id name. And Table 2 with: 1 as the primary key column, 2 as the address column, and 3 as the foreign key column. When I runselect * from table2
I am getting the foreign key result in terms of id, I want the value of the table1.2 column.
Why i ask
This is because with this type of system, I can query every row in the database without having to manually code for every table.
Pictures for a better explanation
Workshop employee table
Attendance table
The result I want
source to share
No one has answered this question yet
Check out similar questions: