Reputation: 4864
Can you look at my coding and let me know what I'm missing or doing wrong?
I have a SSRS report that is called from a ReportViewer control and the ProcessingMode for this control is Remote. The report also has 1 parameter in it's DataSet.
In the code I placed a MsgBox to make sure the code is finding the parameter and returning the parameter name. I am trying to stick the value of 10 into the parameter for playerID 10. Data for this player does exist.
I believe I need to add some more code to make this work but I'm not sure what else to add.
When the code executes the report is displayed but no data is shown in the report.
Here is the coding:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim paramList As Generic.List(Of ReportParameter) = New Generic.List(Of ReportParameter)()
With Me.ReportViewer1
.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote
With .ServerReport
Dim pinfo As ReportParameterInfoCollection = .GetParameters()
For Each p As ReportParameterInfo In pinfo
MsgBox(p.Name)
paramList.Add(New ReportParameter(p.Name, 10))
Next
If paramList.Count > 0 Then
.SetParameters(paramList)
End If
End With
.ShowParameterPrompts = False
End With
End Sub
Upvotes: 0
Views: 3447
Reputation: 4864
Found a solution though it took a while to find it.
These lines of code will get it working:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rpParameters = New Microsoft.Reporting.WinForms.ReportParameter
rpParameters.Name = "PlayerID"
rpParameters.Values.Add(10)
Me.ReportViewer1.ShowParameterPrompts = False
Me.ReportViewer1.ServerReport.SetParameters(rpParameters)
Me.ReportViewer1.RefreshReport()
End Sub
Upvotes: 1