Sdílet prostřednictvím


ServerReport.SetParameters-Methode

Sets report parameter properties for the report.

Namespace: Microsoft.Reporting.WinForms
Assembly: Microsoft.ReportViewer.WinForms (in microsoft.reportviewer.winforms.dll)

Syntax

'Declaration
'Usage

Parameter

  • parameters
    An array of ReportParameter objects that contains a list of the report parameters properties.

Hinweise

The parameters specified for the SetParameters method must be defined in the original report definition.

Beispiel

The following code example shows how to load a server report into the ReportViewer control and set parameters on the report.

private void SetReportParameters() {
   // Set Processing Mode
   reportViewer1.ProcessingMode = ProcessingMode.Remote;

   // Set report server and report path
   reportViewer1.ServerReport.ReportServerUrl = new
      Uri("http://<ServerName>/reportserver");

   reportViewer1.ServerReport.ReportPath = 
      "/AdventureWorks Sample Reports/Employee Sales Summary";

   List<ReportParameter> paramList = new List<ReportParameter>();

   paramList.Add(new ReportParameter("EmpID", "288", false));
   paramList.Add(new ReportParameter("ReportMonth", "12", false));
   paramList.Add(new ReportParameter("ReportYear", "2003", false));

   this.reportViewer1.ServerReport.SetParameters(paramList);

   // Process and render the report
   reportViewer1.RefreshReport();
}
Private Sub SetReportParameters()
   'Set Processing Mode
   ReportViewer1.ProcessingMode = ProcessingMode.Remote

   ' Set report server and report path
   ReportViewer1.ServerReport.ReportServerUrl = _
      New Uri("http://<ServerName>/reportserver")

   ReportViewer1.ServerReport.ReportPath = _
      "/AdventureWorks Sample Reports/Employee Sales Summary"

   Dim pInfo As ReportParameterInfoCollection
   Dim paramList As New Generic.List(Of ReportParameter)

   paramList.Add(New ReportParameter("EmpID", "288", False))
   paramList.Add(New ReportParameter("ReportMonth", "12", False))
   paramList.Add(New ReportParameter("ReportYear", "2003", False))

   ReportViewer1.ServerReport.SetParameters(paramList)


   pInfo = ReportViewer1.ServerReport.GetParameters()

   ' Process and render the report
   ReportViewer1.RefreshReport()
End Sub

Siehe auch

Verweis

ServerReport-Klasse
ServerReport-Member
Microsoft.Reporting.WinForms-Namespace