我需要檢索的ID的名稱(assessment name
)的LINQ to SQL:通過ID選擇名稱(字符串)(SMALLINT)
public int GetAssessmentNo(int AssessmentNo)
{
int AssNo = (from a in contxt.View_Assessment
where a.id == AssessmentNo
select a.AssessmentName);
return AssNo;
}
無法隱式轉換類型System.Linq.IQueryable'到INT
'AssessmentName'是'string'? – Yoav
你想擁有'AssessmentNo',但你選擇了'AssessmentName' - 是一個錯字嗎?因爲'... Name'聽起來像一個'string' ... – germi