Beispiel #1
0
        private WebForms.ReportDataSource GetReportDataSource(RDL.Report reportDef, RDL.DataSet ds)
        {
            //copy the parameters from the QueryString into the ReportParameters definitions (objects)
            var parameters = CurrentReportViewer.LocalReport.GetParameters();

            ds.AssignParameters(parameters);

            var dataSource = reportDef.DataSources.Find(d => d.Name == ds.Query.DataSourceName);

            //run the query to get real data for the report
            System.Data.DataTable tbl = ds.GetDataTable(dataSource.ConnectionProperties.ConnectString);

            //attach the data/table to the Report's dataset(s), by name
            //This refers to the dataset name in the RDLC file
            return(new WebForms.ReportDataSource
            {
                Name = ds.Name,
                Value = tbl
            });
        }