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;
}

```
```
public string GetAssessmentNo(int AssessmentNo)
{
    string AssNo = (from a in contxt.View_Assessment
                 where a.id == AssessmentNo
                 select a).Single().AssessmentName;
    return AssNo;
}
If you write int Assno you cannot select AssessmentName because it is string datatype.you can change method datatype int to string after this you will get AssessmentName 
Hope it will help you

```