hello friends,
i have a problem with my report when pass a pamameter in vb.net and VS 2005
The code is:
Dim
objParameter =
New ReportParameter("Name", "test") Me.ReportViewer1.LocalReport.SetParameters(objParameter)the error is:
System.InvalidCastException was unhandled
Message="Unable to cast object of type 'Microsoft.Reporting.WinForms.ReportParameter' to type 'System.Collections.Generic.IEnumerable`1[Microsoft.Reporting.WinForms.ReportParameter]'."
Please help me
Rodrigo

Cast error when pass a parameter in localreport and reportviewer
one wonders
I have tried: ReportViewer1.LocalReport.Refresh()
in the page_load with no success.
Armin Zamani
To be clear, are you using ServerReport or a LocalReport
Mitch
lagroue
Can you please give me an working example in VB.net (Visual Studio 2005).
My code is not working:
Private Sub SetReportParameters()
Dim p1 As New ReportParameter("name1", "test1")
Dim p2 As New ReportParameter("name2", "test2")
Dim param() As ReportParameter = {p1, p2}
ReportViewer1.LocalReport.SetParameters(param)
End Sub
AngiKL
Here's how I'm doing it.
Dim RateId as integer = 5
Dim params(0) As ReportParameter
params(0) = New ReportParameter("RateId", RateId, False)
Me.ReportViewer1.ServerReport.SetParameters(params)
Me.ReportViewer1.ServerReport.Refresh()
TopOracle
AntonioCS
Thanks for your response.
The first time the report loads, the title shows the rdlc default value, which doesn't match the data default value.
For example, "Income Statement as of " & parameters!portfoliodate.Value
In the dataset the portfoliodate is the last date with data while in the rdlc fields are not allowed.
Please let me know if I am missing something.
Thanks.
Fred de Lange
Your post has been very helpful, thanks.
I run into a problem though when the default value of the report parameter is not a constant such as a date.
In the rdlc, the report parameter default can not be a field, i.e. only lets me hard code it. So the first time the report is run, the title of the report will say 1/1/2006 and the data is from 4/30/2006. After button_click refresh, the title updates.
Any ideas
Gloria123
I had that problem as well, if I don't supply a parameter, error will show.
As the default report is useless, what I did is to set the reportview's visible=false.
After a parameter is set, I set the visible=true.
It's kind of silly, but it works.
Good Luck,
Long
techSage
_random
Hi,
We are facing the same problem in passing parameters through VB.NET
If anyone has the code snippet , can you please put it across here .
Thanks and Regards,
Soni
TheVenkster
Adriann
Rod -
Would you be so kind as to post a quick example of how you accomplished this using vb.net
Thanks
Mitch
A Noble
ReportParameter moduleDescriptionParameter = new ReportParameter("ModuleDescription", "Test Module");
ReportParameter statusParameter = new ReportParameter("BugStatus", "Open");
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { moduleParameter, moduleDescriptionParameter, statusParameter });
Milinda V
Hi Brian,
I have the similar problem.
Please, you have one example of this.
Thanks.
Alex.