I am trying to fetch the data from database using database first approach and want to display the data in a list.. I am trying the following code for this
This is my Action method
public ActionResult transaction()
{
var result = from T in db.tbProcTransactions
select T.pServiceID;
return View(result);
}
and in my view I write this
@model IEnumerable<LinQuery.Models.tbProcTransaction>
@{
ViewBag.Title = "transaction";
}
<h2>transaction</h2>
@foreach (var serviceID in @Model.pServiceID)
{
@serviceID;
}
But when I run this code I get this Error
System.Collections.Generic.IEnumerable' does not contain a definition for 'pServiceID' and no extension method 'pServiceID' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
I am unable to resolve this error Please resolve this error experts
IEnumerable<typeof(pServiceID)>. Simplest solution is to useselect T;instead ofselect T.pServiceID;