我的应用程序是使用实体框架的 asp.net MVC3。我正在尝试使用以下方法从表中获取一列的列表作为数组:
public ActionResult Index()
{
//var list = db.CasesProgresses.ToList();
var SeriesList = GetSeriesList(Learner_ID);
return View();
}
public List<string> GetSeriesList(string item)
{
// get DataTable dt from somewhere.
List<string> sList = new List<string>();
foreach (CasesProgress row in db.CasesProgresses)
{
sList.Add(row[0].ToString());
}
return sList;
}
我收到两个错误:
Cannot apply indexing with [] to an expression of type 'caseprog.Models.CasesProgress' and
The name 'Learner_ID' does not exist in the current context
将不胜感激您的建议。