Report Designer Standalone - Invalid value of report parameter

1 Answer 18 Views
.NET 5 DataSource SQL Programming Report Designer (standalone) Report Parameters
Elias
Top achievements
Rank 1
Iron
Elias asked on 14 Feb 2024, 04:11 AM | edited on 14 Feb 2024, 04:11 AM

I created a report using Telerik Report Designer Standalone with sqlDataSource1 setup with the following ReportParameters like this:



C# coded that read that send the parameter as Int32

    var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
    // set any deviceInfo settings if necessary
    var deviceInfo = new System.Collections.Hashtable();
    var reportSource = new Telerik.Reporting.UriReportSource();
    var directory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
    var value = Convert.ToInt32(numericExportarPdf.Value);
    reportSource.Uri = "Report.trdp";
    reportSource.Parameters.Add("NRO_TICKET", value);
    Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, deviceInfo);
    if (result.HasErrors) return;
    string fileName = result.DocumentName + "." + result.Extension;
    string path = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
    string filePath = Path.Combine(path, fileName);
    using FileStream fs = new FileStream(filePath, FileMode.Create);
    fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);

I get the following error:

Telerik.Reporting.Processing.CancelProcessingException: An error has occurred while processing the report. Processing canceled. Check the InnerException for more information.
 ---> System.Exception: Invalid value of report parameter 'NRO_TICKET'.
   --- End of inner exception stack trace ---
   at Telerik.Reporting.Processing.Report.ValidateParameters()
   at Telerik.Reporting.Processing.Report.ProcessItem()
   at Telerik.Reporting.Processing.ReportItemBase.ProcessElement()
   at Telerik.Reporting.Processing.Report.ProcessElement()
   at Telerik.Reporting.Processing.ProcessingElement.Process(IDataMember dataContext)
   at Telerik.Reporting.Processing.Report.Process(Boolean processItemActions, Boolean documentMapEnabled)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessReport(Report report, IPathResolver pathResolver, IProcessingContext parentContext, IEnumerable`1 parameters, Key rootKey, Boolean interactivityEnabled, Boolean documentMapEnabled, PageLayoutInfo pageSettings, ErrorEventHandler errorHandler, List`1 documentNodes, Boolean& documentMapAvailable)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessResolvedReports(ResolvedReportDocument resolvedReportDocument, IList`1 parameters, IProcessingContext contextPerDocument, Boolean interactivityEnabled, Boolean documentMapEnabled, PageLayoutInfo pageSettings, List`1 processedReports, ErrorEventHandler errorHandler, List`1 documentNodes, Boolean& documentMapAvailable, ListSlice& tocReportsSlice)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessReportSource(ReportSource reportSource, IRenderingContext context)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessReportSource(ReportSource reportSource, Hashtable deviceInfo, IRenderingContext context)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRender(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRenderStateless(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)
   at Telerik.Reporting.Processing.ReportProcessor.<>c__DisplayClass47_0.<RenderReport>b__0(SingleStreamManager sm)
   at Telerik.Reporting.Processing.ReportProcessor.RenderReportSafe(Func`2 renderCallback, String format, IRenderingContext renderingContext)
   at Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, ReportSource reportSource, Hashtable deviceInfo, CancellationToken cancellationToken)
   at Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, ReportSource reportSource, Hashtable deviceInfo)

If I remove the parameter the report works fine, I added changing to Decimal Type value as my DB engine is MS-SQL 2022 Express. I added filters and get same error. I don't know what to do anymore What I am missing

1 Answer, 1 is accepted

Sort by
0
Accepted
Elias
Top achievements
Rank 1
Iron
answered on 14 Feb 2024, 07:36 PM
Fixed my issue with removing and creating from zero the sqlDataSource1 and properly assigning the parameters.Value and parameters in


Tags
.NET 5 DataSource SQL Programming Report Designer (standalone) Report Parameters
Asked by
Elias
Top achievements
Rank 1
Iron
Answers by
Elias
Top achievements
Rank 1
Iron
Share this question
or