コード例 #1
0
        private void BindData()
        {
            DataTable tb = SPDayReportWrapper.GetClientGroupTotalReport(StartDate.Date, EndDate.Date);

            //tb.Columns.Add(new DataColumn("Amount", typeof (decimal), ""));

            //tb.AcceptChanges();

            ReportDataSource rds = new ReportDataSource("DataSet1", tb);

            ReportViewer1.LocalReport.DataSources.Clear();
            ReportViewer1.LocalReport.DataSources.Add(rds);

            string reportName = string.Format("【{0}】-【{1}】下家结算报表", StartDate.ToString("yyyy-MM-dd"), EndDate.ToString("yyyy-MM-dd"));

            ReportParameter rpReportName = new ReportParameter();

            rpReportName.Name = "ReportName";
            rpReportName.Values.Add(reportName);

            ReportViewer1.LocalReport.SetParameters(
                new ReportParameter[] { rpReportName });

            ReportViewer1.LocalReport.Refresh();
        }