> > public ReportDocument PushReportData > (DataSet DsReportData, ReportDocument oReport) > { > // Call when a report is generated > // Calls SetData for the main report object > // Also calls SetData for any subreport objects > > this.SetData(DsReportData,oReport); > > foreach(ReportDocument oSubReport in oReport.Subreports) > this.SetData(DsReportData,oSubReport); > > return oReport; > > } > > private void SetData > (DataSet DsReportData, ReportDocument oReport) > { > // receives a DataSet and a report object (could be the > // main object, could be a subreport object) > > // loops through the report object's tables collection, > // matches up the table name with the corresponding table > // name in the dataset, and sets the datasource accordingly > > // This function eliminates the need for a developer to > // know the specific table order in the report > > foreach (Table oTable in oReport.Database.Tables) > oTable.SetDataSource > (DsReportData.Tables[oTable.Name.ToString()]); > > } >>
>ccCrystalManager oCrystalManager = new ccCrystalManager(); >RPT_TimeSheet oTimeSheetReport = new RPT_TimeSheet(); > >oTimeSheetReport = oCrystalManager.PushReportData(dsData, > oTimeSheetReport); > >// and then use the report object to preview or print or export > >>