zoukankan      html  css  js  c++  java
  • (转)在VS2012后的版本中做数据报表时,提示尚未指定报表“Report1”的报表定义

    转自:http://www.cnblogs.com/ljx2012/p/4093474.html

    有一群的朋友在用VS2012做数据报表时,老是提示

        本地报表处理期间出错。
            尚未指定报表“Report1”的报表定义
                未将对象引用设置到对象的实例。

    我看了一下,步骤没错,我用VS2010做了一下,一切OK,没问题,但用VS2013做时,

    就提示这错误

    后仔细看了一下设计生成的源码,嘿,还真有区别,在VS2012与VS2013中,

    ReportViewer生成的代码在引用报表数据时,使用的是ReportEmbeddedResource属性

    <LocalReport  ReportEmbeddedResource="WebApplication1.Report1.rdlc">
                    <DataSources>
                        <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
                    </DataSources>
                </LocalReport>
     在VS2010的版本中使用的是ReportPath
    <LocalReport  ReportPath="Report1.rdlc">
                   <DataSources>
                       <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
                   </DataSources>
               </LocalReport>

    而ReportPath与ReportEmbeddedResource的区别是:

    ReportPath是获取或设置本地报表的本地文件系统路径,

    设置 ReportPath 属性将导致 ReportViewer 控件从文件系统自动加载所需的任何子报表。

    设置此属性将导致ReportEmbeddedResource 属性的值被忽略

    ReportEmbeddedResource是嵌入报表资源是已经作为资源存储在调用程序集中的报表定义。

    因为要手动修改使用ReportPath,就能解决这问题

    本人在vs2008 网站ReportEmbeddedResource改为ReportPath="Report1.rdlc" 也可以了

  • 相关阅读:
    微信公众号菜单demo
    Hosts 广告
    thinkphp用swiftmailer发邮件demo
    微信小程序小结(4) -- 分包加载及小程序间跳转
    微信小程序小结(5) -- 常用语法
    常用SQL语句及在node中使用MySQL
    JavaScript -- tips
    CSS3 -- FlexBox(弹性盒子)
    gulp使用文档
    yarn快速使用及实践建议
  • 原文地址:https://www.cnblogs.com/wentian2010/p/5045462.html
Copyright © 2011-2022 走看看