i am trying to do this in lambda :
Select Hint from [tablename] where Answer = 'answer';
this is what i have tried so far :
public ModelSQL.puzzlecontent GetAcrossClue(string answer)
{
return context.puzzlecontents.Where(c => c.Answer.Equals(answer)).Select( g => new {g.Hint});
}
Error says :
Cannot implicitly convert type 'System.Linq.IQueryable' to 'iStellar.ModelSQL.puzzlecontent'. An explicit conversion exists (are you missing a cast?)
ModelSQL.puzzlecontent? This type should be made clear.puzzlecontents.new {g.Hint}you're returning an IEnumerable<> of an anonymous type (what type ever g.Hint is), this doesnt match the signature of the return type of the method (ModelSQL.puzzlecontent). You'll have to select something of type ModelSQL.puzzlecontent and use First/Single(OrDefault) on the result to match the signature of the method.