Posted 12 June 2022, 11:21 pm EST
Thank you. I see that your sample does ask for the parameter (and then fails due to a SQL error).
Your code is different than ours for loading the report onto the viewer.
I have modified your code to be the same as ours, and yours fails (it doesn’t ask for the parameter and fails on the rpt.run line with an error: “Exception has been thrown by the target of an invocation”).
GrapeCity.ActiveReports.SectionReport rpt = new GrapeCity.ActiveReports.SectionReport();
rpt.LoadLayout(System.Xml.XmlReader.Create(“./sampleRpt1.rpx”));
//viewer1.LoadDocument(rpt);
rpt.Run(false);
viewer1.Document = rpt.Document;
I modified our code to load and run the ways yours does using the view.loaddocument(rpt) and we receive the generic error “Object reference not set to an instance of an object”.
In addition, i see your code is using AR 16.1.1.0 and ours is using 16.0.0.0 - not sure if this is causing any type of issue - i don’t think so seeing as when i change your code it fails also.
Our psuedo code is:
rpt.userdata=sqlconnectionstring
rpt.datasource=sqldatareader (with the data already loaded in it from the SQL select statement)
rpt.run(False)
viewer.document=rpt.document
Thanks for any additional help you can provied.