时间:2017-09-05 05:12:22

标签: c# asp.net-mvc reporting-services

我使用Visual Studio创建了一个SQL报告(在使用Report Builder时也可以使用)。该报告由主报告和其中的子报告组成。通过Visual Studio或Report Builder运行报表或发布到报表服务器时,它工作正常,主报表和子报表显示正确。

我有一个显示报告的ASP.Net MVC应用程序,但它也允许用户在运行之前指定where子句。当报告通过MVC应用程序运行时,它只显示主报告,然后说:

  

子报告'子报告'在指定位置找不到   [MVC应用程序指令]请验证子报告已经存在   已发布且名称正确。

即使报告在那里。

以下是加载并显示报告的代码片段:

        if (ReportFileName != null && ReportFileName != "")
        {
                ViewBag.Title = "Reporting";
                reportViewer.ProcessingMode = ProcessingMode.Local;
                reportViewer.SizeToReportContent = true;
                reportViewer.Width = Unit.Percentage(100);
                reportViewer.BackColor = System.Drawing.Color.White;
                reportViewer.Height = Unit.Percentage(100);
                SqlConnection conx = new SqlConnection(ConfigurationManager.ConnectionStrings[""].ConnectionString);
                SqlDataAdapter adp = new SqlDataAdapter(Basequery, conx);
                DataTable dt = new DataTable();
                adp.Fill(dt);
                adp.Fill(ds.Tables[0]);

            reportViewer.LocalReport.ReportPath = ReportFileName;

        }
        reportViewer.LocalReport.DataSources.Clear();

        reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ReportDataSet", ds.Tables[0]));
        reportViewer.LocalReport.Refresh();
        ViewBag.ReportViewer = reportViewer;
        return PartialView("ReportView");

有什么东西我不见了吗?

0 个答案:

没有答案