I am trying to make a small website using mvc3 and c# and im a little stuck with this LINQ query.
I have two tables:
-
Agents (id, firstName, lastName, login, password)
-
SubAgents (subAgentsId, agentsId)
here the Agents.id == SubAgents.agentsId
var query = from subAgent in db.SubAgents
join agent in Agents on subAgent.AgentID equals agent.ID
select agent;
I have a similar join statement thats running for Agent and Client. but that runs fine. here unfortunately it keeps giving me this error.
“Entity command ExecutionException was unhandled by user code”
This error pops up just before I am ready to send the subagents details to the view.
Dont know what im doing wrong.
Use the navigation property.