1

我有一个 .NET 4.5、Visual Studio 2012 winforms 项目,它应该使用 Visual Studio 2012 ReportViewer 控件显示相当多的 SSRS 2005 远程报告。

显然,要在 Visual Studio 2012 中使用 reportViewer 显示远程报表,Reporting Services 报表服务器必须是 SQL Server 2008 或更高版本。所以我很困惑,想知道是否有解决方法,或者是否可以在 VS 2012 项目中使用 VS 2008 的 reportViewer。

我得到的是

"远程报表处理需要 Microsoft SQL Server 2008 Reporting Services 或更高版本"

这就是设置报告源的方式

private void SetReportParameters()
        {
            //Set Processing Mode
            reportViewer1.ProcessingMode = ProcessingMode.Remote;

            // Set report server and report path
            reportViewer1.ServerReport.ReportServerUrl = new Uri("http://Server/ReportServer");
            reportViewer1.ServerReport.ReportPath = "/MyApplicationReports/ReportName";

            ReportParameterInfoCollection pInfo = default(ReportParameterInfoCollection);
            System.Collections.Generic.List<ReportParameter> paramList = new System.Collections.Generic.List<ReportParameter>();

            paramList.Add(new ReportParameter("EmpID", OriginalEmployeeID.ToString(), false));
            reportViewer1.ServerReport.SetParameters(paramList);
            pInfo = reportViewer1.ServerReport.GetParameters();

            // Process and render the report
            reportViewer1.RefreshReport();

        }

接着

 private void EmployeeLeaveHistory_Load(object sender, EventArgs e)
    {
        SetReportParameters();
        this.reportViewer1.RefreshReport();
    }

或者是否可以先获取远程报表,将其转换为本地报表对象并在报表查看器中显示本地报表对象?

4

1 回答 1

2

我有一个解决方案。我去了项目引用并删除了 Visual Studio 2012 的 Microsoft.ReportViewer.Common.dll 和 Microsoft.ReportViewer.WinForms.dll。

然后,我为 Visual Studio 9(VS 2008)重新添加了对 Microsoft.ReportViewer.Common.dll 和 Microsoft.ReportViewer.WinForms.dll 的引用,现在 VS 2008 的报告查看器正在 VS 2012 中工作。

于 2013-02-06T12:56:57.513 回答