Set Parameters RDLC Report C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Set Parameters RDLC Report C#

Hello, in my rdlc report I create parameter test. In form I write below code to set parameter //Set Parameters ReportParameter[] p = new ReportParameter[1]; p[0] = new ReportParameter("Test", "Testing"); currentBilling_rv.LocalReport.SetParameters(p); // Provide datasource to report Current_Total_Billing.rdlc ReportDataSource rds = new ReportDataSource("CurrentTotalBilling", dataset.Tables[2]); currentTotalBilling_rv.LocalReport.DataSources.Clear(); currentTotalBilling_rv.LocalReport.DisplayName = "Current Total Billing"; currentTotalBilling_rv.LocalReport.ReportPath = ".\\Current_Total_Billing.rdlc"; currentTotalBilling_rv.LocalReport.DataSources.Add(rds); currentTotalBilling_rv.RefreshReport(); When I run the program I have exception An unhandled exception of type 'Microsoft.Reporting.WinForms.MissingReportSourceException' occurred in Microsoft.ReportViewer.WinForms.dll Additional information: The source of the report definition has not been specified Please help.

13th Dec 2017, 7:54 PM
Salman Mushtaq
Salman Mushtaq - avatar
13 Answers
+ 1
Ues , I open report data tool , write click on parameters and add new parameter name Test, then drag this parameter in header.
13th Dec 2017, 9:50 PM
Salman Mushtaq
Salman Mushtaq - avatar
+ 1
I also try by doing by setting ProcessingMode.Local but same exception.
13th Dec 2017, 9:52 PM
Salman Mushtaq
Salman Mushtaq - avatar
+ 1
Can you please give me some solution because i am trying all possible ways and stuck now.
13th Dec 2017, 9:59 PM
Salman Mushtaq
Salman Mushtaq - avatar
0
In which line does the exception occur ?
13th Dec 2017, 9:22 PM
sneeze
sneeze - avatar
0
@sneez , this line currentBilling_rv.LocalReport.SetParameters(p);
13th Dec 2017, 9:25 PM
Salman Mushtaq
Salman Mushtaq - avatar
0
It looks like there are not enough parameters in the array. Can you view the expected parameters in a parameterslist in the report-layout. What happens when you comment this line ?
13th Dec 2017, 9:34 PM
sneeze
sneeze - avatar
0
Have a look at this link https://stackoverflow.com/questions/27996831/how-to-set-parameter-values-in-rdlc DateTime dtStartDate = dateTimePicker1.Value; DateTime dtEndDate = dateTimePicker2.Value; ReportParameter[] params = new ReportParameter[2]; params[0] = new ReportParameter("StartDate", dtStartDate, false); params[1] = new ReportParameter("EndDate", dtEndDate, false); this.ReportViewer1.ServerReport.SetParameters(params); It looks like there is difference between the list and the parameters. edit : sorry is not true, you are doing it in the same way
13th Dec 2017, 9:42 PM
sneeze
sneeze - avatar
0
I have one table have four fields, i will query the result and assign the datasource, this work fine. now i need to show the value of profile, i want to send data from form. how I do this?
13th Dec 2017, 9:43 PM
Salman Mushtaq
Salman Mushtaq - avatar
0
Do you have the parameters in your report layout ? https://www.youtube.com/watch?v=WGKzFKgeoo8
13th Dec 2017, 9:48 PM
sneeze
sneeze - avatar
0
Just another link that might help. https://stackoverflow.com/questions/6297282/how-to-fix-the-bug-local-processing-exception-was-unhandled-when-passing-paramet this.reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;
13th Dec 2017, 9:50 PM
sneeze
sneeze - avatar
0
Thank you for your responses, it is giving a lot of information.
13th Dec 2017, 9:54 PM
sneeze
sneeze - avatar
0
Just another link, Just guessing no experience with rdlc https://www.codeproject.com/Questions/208964/How-to-Fix-the-bug-Local-processing-Exception-was Does it help if you set the the parameters last, before RefreshReport
13th Dec 2017, 10:00 PM
sneeze
sneeze - avatar
0
Sorry no easy solution, I was just googling.
13th Dec 2017, 10:01 PM
sneeze
sneeze - avatar