示例#1
0
        private void BindData()
        {
            ReportViewer1.LocalReport.EnableHyperlinks = true;

            DataTable tb = SPDayReportWrapper.GetProvinceReport(StartDate, EndDate, ReportChannleID, ReportClientChannleID);

            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"));

            if (ReportChannleID == 0)
            {
                reportName = "全平台" + reportName;
            }
            else
            {
                SPChannelWrapper channel = SPChannelWrapper.FindById(ReportChannleID);

                if (ReportClientChannleID == 0)
                {
                    reportName = string.Format("通道【{0}】", channel.Name) + reportName;
                }
                else
                {
                    SPClientChannelSettingWrapper clientChannelSetting = SPClientChannelSettingWrapper.FindById(ReportClientChannleID);

                    reportName = string.Format("通道【{0}】", channel.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();
        }