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 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 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 Problem
My 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. The error is [red]Invalid Section[/red]. 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)
[red]rprt.SetParameterValue(names, values);[/red]
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. That very same function is used for about 25 other reports which use the same scheme 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 (parameter values are proper), but it still doesn't work.
What I have tried
As it turns out, if I were to eliminate the command parameters and declare them in the report itself, everything works perfectly. However, this does me no good as I need those parameters in the command. Also, other reports that I have use that very same method of declaring parameters in the command and they work just fine.
Any ideas?
Thanks.
JC
_________________________________
I think, therefore I am. [Rene Descartes]
My Environment
OS: Windows 2000 Server, all 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 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 Problem
My 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. The error is [red]Invalid Section[/red]. 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)
[red]rprt.SetParameterValue(names, values);[/red]
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. That very same function is used for about 25 other reports which use the same scheme 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 (parameter values are proper), but it still doesn't work.
What I have tried
As it turns out, if I were to eliminate the command parameters and declare them in the report itself, everything works perfectly. However, this does me no good as I need those parameters in the command. Also, other reports that I have use that very same method of declaring parameters in the command and they work just fine.
Any ideas?
Thanks.
JC
_________________________________
I think, therefore I am. [Rene Descartes]