Hello!
I'm currently upgrading Telerik reporting in my application from version 5.1.11.928 to version 8.2.14.1204. I am using Visual Studio 2010, using C#.
I'm encountering a problem with a report parameter using a sqlDataSource. At first, I was encountering a problem because an arraylist was being used in a parameter (as an ansistring). This caused an error with XML serialization. So I realized that an arraylist wouldn't work anymore. However, the query its using is relying on accepting a collection of values.
(e.g. (Where number.ID IN (@ValueType) )
I saw that I can change the parameter to accept multiple values from:
http://www.telerik.com/help/reporting/designing-reports-parameters.html
However, I can't seem to get it to work correctly. For some extra context I have also changed the collection to a hashset<int>.
The report parameters are being set with code that uses the reportviewer.
Example:
var genericReport = new GenericReport();
genericReport.ReportParameters["ValueType"].Value = hashValueGenerator("Selector");
//hashValueGenerator returns a hashset of integers based upon its selector
//This used to be an arrayListGenerator
From there, the code would then take the report that was generated and add it to the reportSource. (This part works fine.)
I believe I am setting up my value type incorrectly to accept the new collection I'm creating.
Here is the parameter as it existed before the upgrade:
Name: @ValueType
DbType: AnsiString
Value: =Parameters.ValueType.Value
This is my attempted fix to my problem:
Name: @ValueType
DbType: Int32
Value: //Shown below as created in the Report Parameter Editor
//Only the bolded (non-default) changes are being displayed
//Organized to look like pseudocode, but I am using the editor
//Quotes are for readability, they are not used in the actual editor boxes
Report Parameter{
AvailableValues {
DataSource = sqlDataSource,
//The same as shown as the data source on the report designer.
ValueMember= "=Parameters.ValueType.Value"}
MultiValue= true,
Name= ValueType,
Text= ValueType,
Type= Integer,
Visible= true
}
I get the following error in my Report Viewer: "Missing or invalid parameter value. Please input valid data for all parameters."
Can anyone give me any insight as to what I'm doing wrong?
Thank you very much!