日期:2014-05-18 浏览次数:21326 次
reportViewer1.ProcessingMode = ProcessingMode.Local; reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); LocalReport localReport = reportViewer1.LocalReport; localReport.ReportEmbeddedResource = "AxAssistant.Forms.PickListJournal.rdlc"; ReportDataSource rdsPickListJournal = new ReportDataSource(); rdsPickListJournal.Name = "dsPickList_ProdJournal"; rdsPickListJournal.Value = dsPickList.Tables["ProdJournal"]; localReport.DataSources.Add(rdsPickListJournal); ReportDataSource rdsJournalBOM = new ReportDataSource(); rdsJournalBOM.Name = "dsPickList_JournalBOM"; rdsJournalBOM.Value = dsPickList.Tables["JournalBOM"]; localReport.DataSources.Add(rdsJournalBOM); ReportDataSource rdsInvent = new ReportDataSource(); rdsInvent.Name = "dsPickList_Invent"; rdsInvent.Value = dsPickList.Tables["Invent"]; localReport.DataSources.Add(rdsInvent); reportViewer1.RefreshReport(); void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e) { ReportDataSource rdsJournalBOM = new ReportDataSource(); rdsJournalBOM.Name = "dsPickList_JournalBOM"; rdsJournalBOM.Value = dsPickList.Tables["JournalBOM"]; e.DataSources.Add(rdsJournalBOM); ReportDataSource rdsInvent = new ReportDataSource(); rdsInvent.Name = "dsPickList_Invent"; rdsInvent.Value = dsPickList.Tables["Invent"]; e.DataSources.Add(rdsInvent); }
------解决方案--------------------
截图出来吧
子报表 点右键->"更改子报表链接..."
------解决方案--------------------
rdlc报表有个好处就是子报表可以嵌套,而水晶报表却不行
------解决方案--------------------
我按7楼说的做了,还是不行。子报表的位置显示:子报表无法显示。
还有如果主表中放多个子报表应该怎么设置Datasource
------解决方案--------------------
加上这一加:
reportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
还不行的话,我就不清楚了。
我的嵌套子报表是指子报表中再包括一个子报表,上面的代码就是这样的一个实例。
------解决方案--------------------