【问题标题】:ReportViewer 9.0 and Visual Studio 2010ReportViewer 9.0 和 Visual Studio 2010
【发布时间】:2012-07-08 14:14:57
【问题描述】:

我正在使用 Visual Studio 2010 制作报告。由于网站中已经使用了旧的 ajax,我们无法使用 ReportViewer 10.0。所以我使用 Report Viewer 9.0 来生成报告。

当我运行应用程序时,我收到以下错误:

本地报告处理过程中发生错误。
报表“主报表”的定义无效。
报告定义无效。详细信息:报表定义具有无法升级的无效目标命名空间“http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition”。

我已将 10.0 ReportViewer 引用更改为 9.0 的引用。我的 web.config 如下:

<?xml version="1.0"?>
<configuration>
     <system.web>

    <httpHandlers>
          <!--<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />-->
          <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </httpHandlers>
    <compilation debug="true" targetFramework="4.0">
      <buildProviders>
         <!--<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />-->
       <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </buildProviders>
    </compilation>
  </system.web>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <!--<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />-->
      <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    </handlers>
  </system.webServer>
</configuration>

而我的Page的代码如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%--<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>--%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <rsweb:ReportViewer ID="rs" runat="server" Font-Names="Verdana" Font-Size="8pt" 
            InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana" 
            WaitMessageFont-Size="14pt">
        <LocalReport ReportPath="Report.rdlc">
            <DataSources>
                <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
            </DataSources>
        </LocalReport>
        </rsweb:ReportViewer>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            SelectMethod="GetData" TypeName="dtAuditTableAdapters.ADT_AuditTableAdapter">
        </asp:ObjectDataSource>
    </div>
    </form>
</body>
</html>

需要解决以下错误:

本地报告处理过程中发生错误。
报表“主报表”的定义无效。
报告定义无效。详细信息:报表定义具有无法升级的无效目标命名空间“http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition”。

【问题讨论】:

    标签: reporting-services reportviewer


    【解决方案1】:

    只需替换您的数据源

    <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
    

    与

    <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="dtAuditTableAdapters" />
    

    希望对你有帮助。

    【讨论】:

      【解决方案2】:

      嗯,看看您发布的代码,您似乎仍然在

      中使用Version=10.0.0.0,
          <system.webServer>
              <validation validateIntegratedModeConfiguration="false" />
              <handlers>
               ........Microsoft.ReportViewer.WebForms, Version=10.0.0.0, ...
              </handlers>
         </system.webServer>
      

      更改Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/&gt;

      致

      Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      

      然后它应该可以工作

      HTH

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-06-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多