0
這裏是我查看代碼:錯誤: 「調用 '讀取' 當DataReader關閉......」
@model IEnumerable<Sample2.Models.Leave_GetDetails_Result1>
@{
ViewBag.Title = "Index";
}
<div>
@foreach (var item in Model) {
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.LA_StaffCode)
</dt>
<dd>
@Html.DisplayFor(model => item.LA_StaffCode)
</dd>
<dd>
@Html.DisplayFor(model => item.LA_AppNo)
</dd>
</dl>
}
</div>
<p>
@*@Html.ActionLink("Edit", "Edit", new { id = Model.Staff_Code }) |*@
@Html.ActionLink("Back to List", "Index")
</p>
當我執行,它提供了錯誤:
"Calling 'Read' when datareader is closed is not a valid operation"
編輯:
的控制器編碼低於我在哪裏調用存儲過程:
using (var context = new Admin_TestEntities())
{
var data = context.Leave_GetDetails("Recommended");
return View(data.AsEnumerable());
}
感謝它的工作。 – RKh