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" 也可以了

  • 相关阅读:
    算法学习——贪心篇
    Centos7下搭建LAMP环境,安装wordpress(不会生产博客,只是一名博客搬运工)(菜鸟)
    小白创建网站的曲折之路
    7.2.5 多层嵌套的if语句
    7.2.4 else与if配对
    7.2.3
    7.4 electirc.c -- 计算电费
    oracle数据库命令行查看存储过程
    Linux下如何查看进程准确启动时间
    7.2 if else 语句
  • 原文地址:https://www.cnblogs.com/wentian2010/p/5045462.html
Copyright © 2011-2022 走看看