Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Having hard time getting ReportViewer control to run reports that have optional (NULL) parameters.

Reports are running fine directly on SSRS within browser, but when I try to run them inside ASP NET WebForm app I am getting null reference errors if optional parameter is set to null (null checkbox is cheeked).

I am getting this (misleading) StackTrace message: at icrosoft.ReportingServices.Common.DateTimeUtil.ParseDateToDefaultFormat => seems that this is some date parsing issue but parameters was integers, strings (no date time parsing is required).

I am using Microsoft.ReportViewer.WebForms, Version=15.0.0.0 with SSRS 2017 and sample app is built using this official documentation: https://docs.microsoft.com/en-us/sql/reporting-services/application-integration/integrating-reporting-services-using-reportviewer-controls-get-started?view=sql-server-ver15

question from:https://stackoverflow.com/questions/65894252/reportviewer-object-reference-not-set-to-an-instance-of-an-object

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

I had the same issue after upgrading to 150.1427.0 version of nuget package. It appears when I pass int or datetime values as parameters

Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.Common.DateTimeUtil.ParseDateToDefaultFormat(String strDateTime, CultureInfo formatProvider)
at Microsoft.Reporting.WebForms.ServerReport.SetParameters(IEnumerable`1 parameters)

According to the release notes they "Fixed a datetime parsing issue affecting certain locales." https://docs.microsoft.com/en-us/sql/reporting-services/application-integration/release-notes-ssrs-application-integration?view=sql-server-ver15

So I downgraded to version 150.1404.0 and the issue has gone


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...