(轉)在VS2012後的版本中做資料報表時,提示尚未指定報表“Report1”的報表定義

來源:互聯網
上載者:User

標籤:

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

(轉)在VS2012後的版本中做資料報表時,提示尚未指定報表“Report1”的報表定義

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.