as the question says I am trying to fill a table in the view from a data table. So far this is my code in the controller:
DataSet dsTemplates = new DataSet();
string qryTemplets = "";
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
conn.Open();
SqlDataAdapter daTemplate = new SqlDataAdapter(qryTemplets, conn);
daTemplate.Fill(dsTemplates, "FileInfo");
DataTable dtTemplates = new DataTable();
dtTemplates = dsTemplates.Tables[0];
List<Models.GameModels.UserList> tables = dtTemplates.Rows.AsEnumerable()
.Select(t => new Models.GameModels.UserList
{
Name = row["Name"],
Record = row["Record"]
})
.ToList();
conn.Close();
return View(tables);
Its giving me the following exception:
'System.Data.DataRowCollection' does not contain a definition for 'AsEnumerable' and the best extension method overload 'System.Data.DataTableExtensions.AsEnumerable(System.Data.DataTable)' has some invalid arguments
Is this the best way to get render a table with multiple rows? Is there a workaround for my error? Thanks in advance. What else can I do?