Click here to Skip to main content
16,004,227 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a problem passing value multivalued parameters from winform and calling the reportviewer. The error is "Parameter X Missing Value".

Scenario
I am using two cascading parameters Country and State. When I pass the values of these parameter using the following code.

C#
Microsoft.Reporting.WinForms.ReportParameter[] reportParameters = new Microsoft.Reporting.WinForms.ReportParameter[2];
Microsoft.Reporting.WinForms.ReportParameter countryParameter = new Microsoft.Reporting.WinForms.ReportParameter("Country","India",true);
Microsoft.Reporting.WinForms.ReportParameter stateParameter = new Microsoft.Reporting.WinForms.ReportParameter("State","Delhi",true);
reportParameters[0]=countryParameter;
reportParameters[1]=stateParameter;
reportViewer.ServerReport.SetParameters(reportParameters); 
reportViewer.ServerReport.Refresh();


I am getting error is "Parameter State Missing Value"
Note: Both the parameters Country and State are filled from query using Available Values. State is filled based on the parameter Country.
Posted
Updated 21-Nov-10 3:45am
v6
Comments
Manfred Rudolf Bihy 21-Nov-10 9:03am    
Reformatted code with indentations so it's more eye friendly.
Sandeep Mewara 21-Nov-10 9:25am    
You have changed your code in question completely!
Manfred Rudolf Bihy 21-Nov-10 9:41am    
When answers are already refering to code posted in your question, it's counter productive to remove that code. You should have instead modified your question with additional code. Can't even see how that code could work considering you didn't have any dimensions when constructing your array. Is there some assumed default dimension?
Debajit Bora 21-Nov-10 9:46am    
Hi Sandeep,
I have changed the code completely.

Hello Debajit,

I would presume this piece of code does not give above mentioned error, but rather when you somehow pass the herein assembled parameters to the report. Since m_Parameters is not passed to the function I assume it's global to the conext the function is defined in. I also presume given the usage of said variable that it's a hash / dictionary of ReportParamters. All of this leads me to speculate that your report requires a parameter named "X" and that parameter is not within your hash / dictionary m_Parameters

Does at any one time have p.value.Name the value "X"? Try that either by debugging or writing these ReportParameter names to a log file.

Cheers

Manfred
 
Share this answer
 
v3
Comments
Debajit Bora 21-Nov-10 9:29am    
Hi,
I have updated the code. Could u pls look into?
Looks like you are not passing values for the parameters always. Depending on scenarios, you pass on one or other.

Either pass the values of all the parameters alawys or mark as parameter value can be null in your SSRS (while designing).
 
Share this answer
 
Comments
Debajit Bora 21-Nov-10 9:28am    
Hi Sandeep,
I have updated the code that is I am passing both the Country and State parameter but still getting the same error. Both the parameters are filled from query using Available Values.

Debajit
Sandeep Mewara 21-Nov-10 9:31am    
If there at any given time, one of the parameter can be empty/null or so then you should mark those paramters as 'allow null value' for them in the SSRS.
Debajit Bora 21-Nov-10 9:51am    
No I am always sending the parameter values
Sandeep Mewara 21-Nov-10 9:57am    
Well, it does not make the thing sound correct - your report has 2 parameters and you are sending valid values of those two parameters to SSRS and yet it throws an error of 'missing value'!

Check if valid values are being passed. Further, there is nothing much to change the thing I said and try out.
Debajit Bora 21-Nov-10 10:26am    
hi Sandeep,

Could u provide me code sample
I had a problem similar to this... and it got solved when I realized that those parameters in the "target" report where set to have "available values" coming from a query... I had set that parameter as hidden

So I just put "available values" as none... and it worked perfectly... ;)
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900