OleDbDataAdapter dt = new OleDbDataAdapter("select UserName from UserInfo where User_ID = (select User_ID from Groupmem_info where Group_ID=(select Group_Member_ID from GroupInfo where Group_ID ='" + grp.Text + "'", con);
Can we use this sort of code in access where I need to display user name from three linked tables. Mutual id’s of group and user will be in Group Members Information Table.
Please suggest how to retrieve User name and I want to display all user names in datagridview.
A more efficient approach would be to change the SQL statement to an inner join and use parametrized queries to avoid SQL Injection attacks:
Now you can call
Fillon theOleDbDataAdapterand set theDataSourceproperty of the grid to whatever table you filled in: