Question: I need to retrieve an id's name (`assessment name`)

```
 public int GetAssessmentNo(int AssessmentNo)
        {
            int AssNo = (from a in contxt.View_Assessment
                         where a.id == AssessmentNo
                         select a.AssessmentName);
            return AssNo;
        }

```

Cannot implicitly convert type **System.Linq.IQueryable**' to **int**

Answer: 
Your query returns a set of integers. 

Use one of these: First(), Single(), FirstOrDefault(), SingleOrDefault()

```
public int GetAssessmentNo(int AssessmentNo)
{
    int AssNo = (from a in contxt.View_Assessment
                 where a.id == AssessmentNo
                 select a).Single().AssessmentName;
    return AssNo;
}

```

or:

```
public int GetAssessmentNo(int AssessmentNo)
{
    int AssNo = contxt.View_Assessment.Single(a => a.id == AssessmentNo).AssessmentName;
    return AssNo;
}

```
```
     var usersId = contxt.View_Assessment.Where(a=> a.Username == AssessmentName).Select(a => a.Id).FirstOrDefault();

```

This will result with an the user Id as an int .

```
 var usersId = contxt.View_Assessment.Where(a=> a.Id == AssessmentNo).Select(a => a.Name).FirstOrDefault();

```

This will result with a user name as string .