I'm new to SQL Server RS.
I'm getting build errors after writing the following code:
List<ReportParameter> reportParam = new List<ReportParameter>();
reportParam.Add(new ReportParameter("Database", connectionString));
reportParam.Add(new ReportParameter("master_dept", hidMasterDept.Value.ToString().Trim()));
reportParam.Add(new ReportParameter("station_id", hidStationId.Value.ToString().Trim()));
reportViewer.ServerReport.SetParameters(reportParam)
The error message is as follows:
No overload for method 'ReportParameter' takes '2' arguments
But when I build the page using "Build Page" command from the menu, it builds successfully and then the project build succeeds.
When I modify any other page and build the solution, the same build error for this page occurs again.
Any idea how to resolve this? Been spending a lot of time figuring this out.
Thanks in Advance,
Manjunath HK
First make sure that all your parameters are single-valued, not multi-valued.
The best practice is always to create the report parameter just with a name and then adding values to it using Values collection like this:
reportParam.Add((new ReportParameter("Database")).Values.Add(connectionString))
Shyam
|||Hi Shyam,
Thanks for the reply.
I tried the same code suggestion given by you. But still nothing the same problem exists.
|||
Go to the following folder on your machine:
Program Files\Microsoft Visual Studio 8\ReportViewer
right click on Microsoft.ReportViewer.WinForms.dll and go to Version tab and make sure that the version is 8.0.50727.42
Also check out this article:
http://support.microsoft.com/default.aspx/kb/933137
Shyam
|||The problem got solved.I used the following code:
List<Microsoft.Reporting.WebForms.ReportParameter> reportParam = new List<Microsoft.Reporting.WebForms.ReportParameter>();
reportParam.Add(new Microsoft.Reporting.WebForms.ReportParameter("Database", connectionString));
reportParam.Add(new Microsoft.Reporting.WebForms.ReportParameter("master_dept", hidMasterDept.Value.ToString().Trim()));
reportParam.Add(new Microsoft.Reporting.WebForms.ReportParameter("station_id", hidStationId.Value.ToString().Trim()));
I really dont know how it worked. I had already given "using Microsoft.Reporting.WebForms" in my code. But everything is working fine after the above change.
The build succeeded and till now I haven't found any issues.
No comments:
Post a Comment