如何用.net 2005 中自带了控件reportviewer调用已经存在的报表服务器的报表

时间:2023-02-12 00:30:35

        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

        ReportViewer1.ShowParameterPrompts = true;         Microsoft.Reporting.WebForms.ServerReport serverReport = ReportViewer1.ServerReport;

        //   Set   the   report   server   URL   and   report   path           serverReport.ReportServerUrl = new Uri(http://localhost/reportserver2);         serverReport.ReportPath = "/BiFile/PVPlayInfoReport";

        //   Create   the   sales   order   number   report   parameter           // Prepare report parameter.         Microsoft.Reporting.WebForms.ReportParameter[] paras = new Microsoft.Reporting.WebForms.ReportParameter[3];

        paras[0] = new Microsoft.Reporting.WebForms.ReportParameter("ID", "8008");         paras[1] = new Microsoft.Reporting.WebForms.ReportParameter("DatetimeFrom", DateTime.Now.AddMonths(-6).ToShortDateString());         paras[2] = new Microsoft.Reporting.WebForms.ReportParameter("DatetimeTo", DateTime.Now.ToShortDateString());

        this.ReportViewer1.ServerReport.SetParameters(paras);