I have two tables named Rank and CrewMembers.I want to fetch the name of rank which is present in Rank table on the basis of id of CrewMember.I have passed the crewId as a parameter and on the basis of that the method would return the Rank of that specific Crew Member.This is how my code is-
public string GetRank(int CrewId)
{
string rank = (from r1 in context.Rank
join r2 in context.CrewMember on r1.RankId equals r2.RankId
where r2.CrewId == CrewId
select r1.RankName);
return rank;
}
When I build the code ,I get the following error-
Cannot implicitly convert type System.Linq.IQueryable to string
where am I going wrong?