Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: Invalid Section

Status
Not open for further replies.

JCruz063

Programmer
Feb 21, 2003
716
US
Hi All... I'm a bit lost with a problem with one of my reports. Here's what's going on:

My Environment
OS: Windows 2000 Server, all service packs and updates installed
Crystal Version: 10 Developer
.NET Version: Framemwork 1.0, with Visual Studio 2002
Database Server: MySql 4.1

Report Setup
My report uses a command to retrive records from the database in a particular way. The report uses parameters, some of which are declared in the report itself, while others are declared inside the command. There is also a sub report, which in turn has its own commands with its own parameters. The parameters of the subreport receive their values from the main report through the "Change Subreport Links..." option. .NET code interacts with the main report by setting the value of its parameters.

The Problem
My report works fine in Crystal, but fails when called from .NET code. The code crashes when it attempts to set the value of a parameter that belongs to the command in the main report. The error returned is [maroon]"Invalid Section."[/maroon], and here is the C# .NET code:
[tt][navy]
private void SetReportParameters(ReportDocument rprt, string[] names, object[] values, string[] subreportNames){
for (int i=0; i<names.Length; i++) {
if (subreportNames.Length == 0)
[maroon]rprt.SetParameterValue(names, values);[/maroon]
else
// This parameter belongs to a subreport
rprt.SetParameterValue(names, values, subreportNames);
}
} //private void SetReportParameters[/navy][/tt]

The above is a very simple, generic function that I use to set the parameters of my crystal reports from .net. This very same function is used for about 25 other reports which use the exact same scheme (parameters and subreports) as the report I'm having issues with. For those reports, it works like a champ. I'm a bit lost with this one, though, as everything checks out (all parameter values are proper), but it still doesn't work.

What I have tried...
1 - Some of the parameters in the subreport and the main report have identical names, and I suspected this had something to do with it. I went ahead and deleted all parameters in the main report, recreated them again with different names, and NOTHING!!!
2 - I also thought that perhaps the fact that some of the parameters were declared in the command was causing the problem... I took them out of the command to no avail...

Deleting the subreport makes it work
If I delete the subreport, the .NET code DOES NOT FAIL, so at least I know that the problem is somehow connected to the subreport. And it's not like I'm new to this parameter and subreport business... I've been dealing with them for a quite a while, and I'm convinced that I'm doing everything right. It's just soo frustrating that it does not work.

Any ideas?

Thanks.

JC

_________________________________
I think, therefore I am. [Rene Descartes]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top