Please do not respond using lamba. I have found similar threads but still need help.
I am trying to display the names from the employees table that are not employees of the currently selected manager.
My two sql tables are structured like this but this is fake data
Employees:
pk name
1 bob
2 sam
3 greg
4 kip
5 jill
6 kelly
7 chris
ExpenseTeamMembers:
pk expMgrPk empPk
1 7 2
2 7 5
3 7 1
4 3 6
5 3 4
So if the the current selected (mgr variable) is 3 I want to get the names of all empPks in the employees table except for 6, 4. (kelly, kip) Right now unselectedEmps = sam, jill, bob instead of all 5 of other names from the employees table.
var unselectedEmps = (from u in db.employees
join o in db.expenseTeamMembers on u.pk equals o.empPk
where o.expMgrPk != mgr
select u.name).ToList();
lstAvailable.DataSource = unselectedEmps;