Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将RDLC移动到服务器时缺少子报告_C#_Reporting Services_Rdlc_Subreport_Reportviewer2008 - Fatal编程技术网

C# 将RDLC移动到服务器时缺少子报告

C# 将RDLC移动到服务器时缺少子报告,c#,reporting-services,rdlc,subreport,reportviewer2008,C#,Reporting Services,Rdlc,Subreport,Reportviewer2008,我很难使用reportviewer在应用程序中显示子报表。在本地调试时,它可以完美地工作。但是当我上传到服务器时,子报告是空白的 我相信SubreportProcessing事件没有触发,因为我没有看到存储过程从SQL Server Profiler触发。这是我正在使用的代码 private void RunReport(string strFormat, int PlanID) { const string reportrdlc = "Reports\\Report_A

我很难使用reportviewer在应用程序中显示子报表。在本地调试时,它可以完美地工作。但是当我上传到服务器时,子报告是空白的

我相信SubreportProcessing事件没有触发,因为我没有看到存储过程从SQL Server Profiler触发。这是我正在使用的代码

private void RunReport(string strFormat, int PlanID)
    {
        const string reportrdlc = "Reports\\Report_All_Sections.rdlc";
        LocalReport report = new LocalReport {ReportPath = Server.MapPath(reportrdlc)};
        report.SetBasePermissionsForSandboxAppDomain(new PermissionSet(PermissionState.Unrestricted));
        report.DataSources.Clear();
        report.SubreportProcessing += SetSubDataSource;

        report.DataSources.Add(new ReportDataSource("DataSet_usp_GetSD", _wpt.Get_SD(PlanID).Copy()));

        report.Refresh();

        string mimeType;
        string encoding;
        string fileNameExtension;
        string[] streams;
        Warning[] warnings;

        byte[] pdfContent = report.Render(strFormat, null, out mimeType, out encoding,
                    out fileNameExtension, out streams, out warnings);

        System.IO.MemoryStream stream = new System.IO.MemoryStream(pdfContent);
        Response.ContentType = strFormat == "EXCEL" ? "application/vnd.ms-excel" : "application/pdf";

        Response.BinaryWrite(stream.ToArray());
        Response.Flush();
        Response.Close();
        stream.Close();

    }
    public void SetSubDataSource(object sender, SubreportProcessingEventArgs e)
    {
        int PlanID = 1;
        if (Request.QueryString["PlanID"] != null)
        {
            try
            {
                PlanID = Convert.ToInt32(Request.QueryString["PlanID"]);
            }
            catch (Exception Ex)
            {
                PlanID = 1;
            }
        }
        switch (e.ReportPath)
        {
            case "Report_All_Mentor":
                e.DataSources.Add(new ReportDataSource("DataSet_usp_GetMC", _wpt.Get_MC(PlanID).Copy()));
                break;
            case "Report_All_Intern":
                e.DataSources.Add(new ReportDataSource("DataSet_usp_GetEA", _wpt.Get_EA(PlanID).Copy()));
                break;
        }


    }

我似乎也有同样的问题。我认为问题在于,当部署的reportPath包含报表的完整路径时,但当您在本地调试时,它只传递报表名称

是否可能确实触发了SubreportProcessing事件,但在switch语句中,没有任何情况与reportPath参数中包含的完整路径匹配


我不知道如何解决这个问题,但我认为这可能是根本原因。

我似乎也有同样的问题。我认为问题在于,当部署的reportPath包含报表的完整路径时,但当您在本地调试时,它只传递报表名称

是否可能确实触发了SubreportProcessing事件,但在switch语句中,没有任何情况与reportPath参数中包含的完整路径匹配


我不知道如何解决这个问题,但我认为这可能是根本原因。

您找到解决方案了吗?没有,我不得不回到2005年的RDLC格式来修复它。如果你知道一个解决方案,让我知道。你找到解决方案了吗?没有,我最后不得不回到2005年的RDLC格式来修复它。如果你知道一个解决方案,让我知道。