私のアプリケーションは、Entity Framework を使用した asp.net MVC3 です。次を使用して、テーブルから 1 つの列のリストを配列として取得しようとしています。
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;
}
2 つのエラーが表示されます。
Cannot apply indexing with [] to an expression of type 'caseprog.Models.CasesProgress' and
The name 'Learner_ID' does not exist in the current context
あなたの提案をいただければ幸いです。