Razor FastReport Net-如何注册数据源?
代码片段:Razor FastReport Net-如何注册数据源?,razor,asp.net-mvc-5,fastreport,Razor,Asp.net Mvc 5,Fastreport,代码片段: WebReport webReport = new WebReport(); // создаем объект webReport.Report.Load(this.Server.MapPath("~/App_Data/frx/krsPrInfo.frx")); webReport.Width = Unit.Percentage(100); ; // задаем ширину webReport.Height = Unit.Percentage(10
WebReport webReport = new WebReport(); // создаем объект
webReport.Report.Load(this.Server.MapPath("~/App_Data/frx/krsPrInfo.frx"));
webReport.Width = Unit.Percentage(100); ; // задаем ширину
webReport.Height = Unit.Percentage(100); ; // задаем высоту
webReport.ReportDataSources = "appData";
webReport.RegisterData(wmasters, "appData");
ViewBag.WebReport = webReport; // передаем данные во View
我一直得到一个错误,这在当前上下文中不存在
错误:(Cell1):错误CS0103:当前上下文中缺少名称“appData”
代码取自于此首先,在您设计的报表中是否有一个名为“appData”的表?其次,您应该将源表(appData)设置为fastreport数据带对象“Data1”或类似的内容。在设计模式下检查报告以获取数据标注栏对象的名称
webReport.Report.Load(this.Server.MapPath("~/App_Data/frx/krsPrInfo.frx"));
webReport.Width = Unit.Percentage(100); ; // задаем ширину
webReport.Height = Unit.Percentage(100); ; // задаем высоту
// webReport.ReportDataSources = "appData";//You dont need this
webReport.RegisterData(wmasters, "appData");
((FastReport.DataBand)webReport.Report.FindObject("Data1")).DataSource = webReport.Report.GetDataSource("appData");
ViewBag.WebReport = webReport; // передаем данные во View
在示例中,您有“AppData”
而不是“AppData”