Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

reporting services - ReportViewer - Object reference not set to an instance of an object

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...