当前位置:编程学习 > C#/ASP.NET >>

请问:如何通过对象数据源显示调用子报表中的数据?

我的部分程序代码是这样的:

public void CreateReport()
        { 
//调用的主报表
            reportViewer1.LocalReport.ReportEmbeddedResource = "LoadMaster.ReportView.ContainersReport.rdlc";

            reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("LoadingTaskBindingSource", LoadingTaskBindingSource));

//调用子报表
            reportViewer1.LocalReport.SubreportProcessing += new Microsoft.Reporting.WinForms.SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
            reportViewer1.RefreshReport();
        }

        void LocalReport_SubreportProcessing(object sender, Microsoft.Reporting.WinForms.SubreportProcessingEventArgs e)
        {
            e.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("LoadingTaskBindingSource", LoadingTaskBindingSource));
            e.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("PackedUnitBindingSource", PackedUnitBindingSource));
            e.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("InterimPackedUnitBindingSource", InterimPackedUnitBindingSource));
            e.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("GoodsStaticsbindingSource", GoodsStaticsbindingSource));
        }

        public void GetGoods_Container_InterimData(LoadingTask tasks)
        {
            this.LoadingTaskBindingSource.DataSource = tasks;
           
            this.PackedUnitBindingSource = this.LoadingTaskBindingSource;
            this.PackedUnitBindingSource.DataMember = "PackedUnits";

            this.InterimPackedUnitBindingSource = this.LoadingTaskBindingSource;
            this.InterimPackedUnitBindingSource.DataMember = "InterimPackedUnits";

            this.GoodsStaticsbindingSource = this.PackedUnitBindingSource;
            this.GoodsStaticsbindingSource.DataMember="GoodsStatics";

            CreateReport();
        }



在程序中如果要显示子报表中的数据,还要添加什么代码吗? --------------------编程问答--------------------   补充一下:主报表和子报表没有数据联系  只是单纯的想在主报表中显示子报表的内容 ,结果执行的时候老是提示Value值为空,不知道是什么原因。
  
   麻烦各位高手帮忙解决一下,比较急,谢谢。。。。
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,