请原谅任何新手的错误。
我正在 MVC 2.0 中编写收据详细信息查找工具,以从我们的 POS 数据库中提取收据详细信息。我编写了返回所需数据的存储过程。我将存储库加载到存储库中。当我尝试在部分视图中加载这些存储过程时,出现堆栈溢出错误。如果我直接在视图中加载相同的代码,它工作正常。我错过了什么吗?
存储库条目
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace CSTools.Models
{
public class QueryRepository
{
RDataContext DB = new RDataContext();
public IEnumerable<CSTools.Models.spGetReceiptDataResult> GetReciptData(int storeID, int transactionNumber)
{
var recipt = from rc in DB.spGetReceiptData(storeID, transactionNumber)
select rc;
return recipt;
}
}
}
控制器:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CSTools.Models;
namespace CSTools.Controllers
{
public class RetailController : Controller
{
QueryRepository Queries = new QueryRepository();
//
// GET: /Trackside/
public ActionResult Index()
{
return View();
}
public ActionResult ReceiptView()
{
return View();
}
public ActionResult ReceiptDataView(int storeID, int transactionNumber)
{
var Receipt = Queries.GetReciptData(storeID, transactionNumber);
return View(Receipt);
}
}
}
看法:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
ReceiptView
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>ReceiptView</h2>
<% Html.RenderPartial("ReceiptView"); %>
</asp:Content>
谢谢!
尼尔