我創建了4個包含來自數據庫中4個表的信息的報告。在我的應用程序中,我有一個menuStrip
,其中包含以此報告命名的項目。如何使我的應用程序reportViewer
顯示在menuStrip
中選擇的報告?在reportViewer中切換.rdlc報告
我試過這段代碼:
ReportDataSource RDS = new ReportDataSource();
RDS.Value = this.KontrolorKazneBindingSource;
reportViewer1.LocalReport.DataSources.Add(RDS);
reportViewer1.LocalReport.ReportPath = @"C:\Users\User\documents\visual studio 2010\Projects\Kontrolor\Kontrolor\KontrolorKazne.rdlc";
reportViewer1.RefreshReport();
但我得到一個錯誤:A data source instance has not been suplied for the data source
你能告訴我什麼,我做錯了,我怎麼能解決這個問題?
是的我得到了它以類似的方式工作: 'ReportDataSource RDC = new ReportDataSource(); RDC.Name =「KontrolorKazneIzvjestaj」; RDC.Value = this.KontrolorKazneBindingSource; this.reportViewer1.LocalReport.DataSources.Add(RDC); this.reportViewer1.LocalReport.ReportEmbeddedResource =「Kontrolor.KontrolorKazneIzvjestaj.rdlc」; this.reportViewer1.RefreshReport();' 我不需要調用重置方法。不管怎麼說,還是要謝謝你 – NDraskovic 2012-01-30 15:00:41