ServerReport.SetParameters Method
Sets report parameter properties for the report.
Namespace: Microsoft.Reporting.WinForms
Assembly: Microsoft.ReportViewer.WinForms (in microsoft.reportviewer.winforms.dll)
Syntax
'Declaration
Public Overrides Sub SetParameters ( _
parameters As IEnumerable(Of ReportParameter) _
)
'Usage
Dim instance As ServerReport
Dim parameters As IEnumerable(Of ReportParameter)
instance.SetParameters(parameters)
public override void SetParameters (
IEnumerable<ReportParameter> parameters
)
public:
virtual void SetParameters (
IEnumerable<ReportParameter^>^ parameters
) override
public void SetParameters (
IEnumerable<ReportParameter> parameters
)
public override function SetParameters (
parameters : IEnumerable<ReportParameter>
)
Parameters
- parameters
An array of ReportParameter objects that contains a list of the report parameters properties.
Remarks
The parameters specified for the SetParameters method must be defined in the original report definition.
Example
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
See Also
Reference
ServerReport Class
ServerReport Members
Microsoft.Reporting.WinForms Namespace