Skip to Content
author's profile photo Former Member
Former Member

Crystal Report with subreports breaks when running on different databases.

HI there

I have a report with 5 subreports on that only works on the database I am designing it on. As soon as I run the report through my application on a database different to the one I design on, it seems to have lost all the parameter fields I created in one of the subreports (the one I have just added, the other 4 work fine) used to link to the main report.

It then pops up with the Parameter Value box and asks for values for 2 parameters that I do not use to link to the subreport, nor have added to the subreport in design time, and in code when I step through the parameterfields list property, the parameters I added in design time to the subreport are not in the list but somehow these 2 parameter fields have been added to the subreport? These 2 parameters have the same names as some main report parameters which have been set already, but as mentioned these somehow now belong to the subreport.

When I run the report through my app on the database I design on all parameters are present and the report works fine.

The parameters in the subreport are all command parameters, linking to a command field, a formula field and another non-command parameter in the main report. All these are set and work fine in the main report.

I set all the parameter values in code to the main report, and the subreports all use those to link to.

I am using CR v10.2 with VB2008 using .NET 2.0 framework (although I had similar problems in VB2005), where the report links directly to a SQL databse via commands. There are 4 commands in the main report and one in the problematic subreport. The subreports command incudes a SQL "IF" statement based on one of the parameters I am linking from the main report.

Please let me know if more info is required.

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 02, 2009 at 06:38 PM

    Hello, Eugen;

    I understand you are using Visual Studio .NET 2008 with bundled Crystal Reports Basic for 2008 (10.5). Do you have a full version of Crystal Reports you use to design reports with or are you designing inside Visual Studio .NET?

    I would like to suggest some ways to test and narrow down the issue.

    One subreport appears to be changing the parameters used when the underlying database changes. Is there a change in the Command it is based on?

    Create a simple report using the same command and the same database as is used in the problem subreport. Run it to confirm you get the same data as in the original.

    Now in design, go into Database|Set Datasource location and change to the new datasource. Do a Database|Verify database. Do you see the change in parameter fields you are seeing at runtime? Has the Command changed? Does it run through the application?

    If you see the same change there, it will have to be addressed in the designer first. If it runs well there, let us look further at the application.

    What is the order of your code?

    Open main report

    Logon to database

    Pass parameters

    Open each subreport

    Logon to the database

    Pass parameters

    View the report.

    Do you set all database locations before passing parameters?

    Were any of the parameters created as "NULL" in the designer?

    Once I have the answers to these questions we can look a little further.

    Elaine

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.