Click here to Skip to main content
13,147,689 members (30,341 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
I am doing college project . In that they want bonafide certificate. For that i planned to pass textbox string to report.

I googled for passing parameter in winform. Then i got this step by step process. I implemented that using the following steps:

1: In Visual Studio 2010, open your .rdlc file, and open “Report Data” window (If you can not see this window, go to View menu to open it).
2: Right click the “Parameters” node, and add a new Parameter, ie: named it “content“.
3: In your .rdlc file, add a textbox, named it tbContent, and set its filed express to :
=Parameters!content.Value

4: Go to your Form file which include your reporterview control, and add the following code:
this.reportViewer1.LocalReport.ReportEmbeddedResource = "TestReport.Report1.rdlc"; ReportParameter rp = new  ReportParameter("content", this.textBox1.Text); 
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); this.reportViewer1.RefreshReport();

5: then you can pass the parameter from the TextBox on the form to .rdlc file;


I added the Microsoft.Reporting.WinForms; assembly reference and used the following code:

this.reportViewer1.LocalReport.ReportEmbeddedResource = "Report1.rdlc";
 
ReportParameter rp = new ReportParameter("content", this.textBox1.Text);
//Following line causes exception:
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
this.reportViewer1.RefreshReport();  


But it throws the following exception,

<quote>Local processing Exception was unhandled at the line:
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });.

Thanks in advance!
Posted 9-Jun-11 8:22am
Updated 16-Nov-16 9:51am
Ed Nutting39.5K
v2
Comments
EdMan196 9-Jun-11 14:32pm
   
Edited for: Readability, code formatting and grammer. <code> tags are for single lines of code, <pre> tags are for blocks of code and 'lang' attribute should be set - in your case 'cs' for CSharp (C#). Ed :)
Sagotharan Jagadeeswaran 9-Jun-11 14:56pm
   
thank u@
Sagotharan Jagadeeswaran 9-Jun-11 21:39pm
   
No solution :(
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

I cant fix this bug. But i solve my problem,...

I got The Solution. Oh God, It take one day of my life.

I hope This solution is help, whom face the same problem in RDLC report.

ReportParameter[] parms = new ReportParameter[n];
parms[0] = new ReportParameter("param_name", textbox(n-1).text);
parms[1] = new ReportParameter("param_course", textbox(n).text);
this.reportViewer1.LocalReport.SetParameters(parms);
this.reportViewer1.RefreshReport();

Thank you For Ur support.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Sagotharan Jagadeeswaran 10-Jun-11 1:24am
   
No friend. I try this, but The same error occurred again. In that question is also asked by me.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

ReportViewer1.ProcessingMode = ProcessingMode.Local;
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

I got this error as well. In my case, my solution was a WebApplication. I was upgrading my solution from VS2010 to VS2015. Everything worked good on my Computer but publishing the site, was having ths stack trace.

My solution;
the servers didn't had "Microsoft System CLR Types for SQL Server 2014" nor
"Microsoft ReportViewer 2015 Runtime"

Got those from Microsoft site and everything worked like a charm.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 16 Nov 2016
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100