private void BindData() { DataTable tb = null; if (ReportType == "1") { tb = SPDayReportWrapper.GetProvinceCityReport(StartDate, EndDate, ReportID, ReportClientChannleID, Province); } else if (ReportType == "2") { tb = SPDayReportWrapper.GetProvinceCityReportForClientGroup(StartDate, EndDate, ReportID, ReportClientChannleID, Province); } ReportDataSource rds = new ReportDataSource("DataSet1", tb); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds); string reporttypeName = ""; if (ReportType == "1") { reporttypeName = "通道"; } else if (ReportType == "2") { reporttypeName = "下家组"; } string reportName = string.Format("【{0}】-【{1}】数据分部报表", StartDate.ToString("yyyy-MM-dd"), EndDate.ToString("yyyy-MM-dd")); if (ReportID == 0) { reportName = "全平台" + reportName; } else { string name = ""; if (ReportType == "1") { name = SPChannelWrapper.FindById(ReportID).Name; } else if (ReportType == "2") { name = SPClientGroupWrapper.FindById(ReportID).Name; } if (ReportClientChannleID == 0) { reportName = string.Format(reporttypeName + "【{0}】", name) + reportName; } else { SPClientChannelSettingWrapper clientChannelSetting = SPClientChannelSettingWrapper.FindById(ReportClientChannleID); reportName = string.Format(reporttypeName + "【{0}】", name) + string.Format("指令【{0}】", clientChannelSetting.MoCode) + reportName; } } ReportParameter rpReportName = new ReportParameter(); rpReportName.Name = "ReportName"; rpReportName.Values.Add(reportName); ReportViewer1.LocalReport.SetParameters( new ReportParameter[] { rpReportName }); ReportViewer1.LocalReport.Refresh(); }