mhertzfeld / CrystalReportsNinja

A fork of a small Windows Console App that loads and executes Crystal Reports, exporting the results to a variety of supported file formats, email or printed. This fork includes numerous features and fixes that are not a part of the forked project.
26 stars 19 forks source link

Fix for subreport parameters #17

Closed mhertzfeld closed 5 years ago

mhertzfeld commented 5 years ago

Issue from @fabian-sta on the commit below.

https://github.com/mhertzfeld/CrystalReportsNinja/commit/c166eaa52f655476c0abe9c0cc70d4c8e3a62acb#commitcomment-35657528

Without this fix i get this error: 25-10-2019 11:40:22 Exception: Error in File Reportname 528813804{C0ED7AED-FD83-487A-82B3-F79C18719535}.rpt: Operation illegal on linked parameter. 25-10-2019 11:40:22 Inner Exception: System.Runtime.InteropServices.COMException (0x80000290): Error in File Reportname 528813804{C0ED7AED-FD83-487A-82B3-F79C18719535}.rpt: Operation illegal on linked parameter. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) Exception: Error in File Reportname 528813804{C0ED7AED-FD83-487A-82B3-F79C18719535}.rpt: Operation illegal on linked parameter. Inner Exception: System.Runtime.InteropServices.COMException (0x80000290): Error in File Reportname 528813804{C0ED7AED-FD83-487A-82B3-F79C18719535}.rpt: Operation illegal on linked parameter. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

If i apply this fix i get error: 25-10-2019 11:39:12 Exception: Not enough memory for operation. 25-10-2019 11:39:12 Inner Exception: Exception: Not enough memory for operation. Inner Exception:

mhertzfeld commented 5 years ago

Sorry to hear you are having problems. I haven't been able to do much testing on the 1.4.0.0 branch yet.

Is this issue occurring in all reports you are trying to run or a specific report(s)?

Can you describe the basics of the report? Are there sub-reports?

fabian-sta commented 5 years ago

So far i have found that if the Report has active Subreport Parameter links it throws the "Not enough memory for operation" error. If you remove the links we are then getting Missing Parameters. All the parameters are provided and exist on the primary and sub reports Still trying to identify the common cause

mhertzfeld commented 5 years ago

I think I have a fix for this. Changes have been pushed to the 1.4.0.0 branch.

I was able to replicate a problem with Linked Parameters, but probably not your exact issue. Please test and let me know the results. If this doesn't work I may need you to mock up a sample report for me to test with on my side.

fabian-sta commented 5 years ago

I see what you have done which makes sense, however it is still not working for our particular reports. Result with NON Linked Parameters.txt Result with Linked Parameters.txt

fabian-sta commented 5 years ago

Issue resolved, ended up being a few things in the report

  1. Needed to have an SQl Connection on the main report with all the parameters specified

    • Setup a connection to the server
    • Added all the required parameters
    • Add "Select {parameter1},{parameter2},{parameter3},etc.." to the query
  2. Also had an issue were some of the reports had different SQL Connection Providers

    • Provider: SQLOLEDB and SQLCLI10
    • Updated the connections on all the Reports to the SAME Connection

Test all ok after that

Now with the change you made regarding the isLinked value on the parameter, the query works with or without linking the Parameters internally

Attached is my updated source code in whuich i have added/Tweaked CrystalReportsNinja.zip not sure how to submit through GiT

mhertzfeld commented 5 years ago

OK, glad you figured it out. Good to hear that this branch seems to be working ok now. I'm planning on merging the banch into my master today.

Follow the instructions below to fork my master branch and merge your changes into it.

https://guides.github.com/activities/forking/

mhertzfeld commented 5 years ago

I created a new branch 1.5.0.0, please fork and do the pull request on that branch.

I can copy your code from the zip file above into 1.5.0.0 branch if you want me to. But it's probably better if you do so that the changes appear under your user name.