Hi,
I hope this is the right forum (wasn't sure if it should be here, in the Interbase forum or in the Delphi forum).
Here is the situation:
I have a Crystal report (v9) that calls a stored procedure in Interbase 7.5.
If I run the stored procedure in IB Expert, it runs fine.
If I run the Crystal report in Crystal and input the parameters, it runs fine.
When trying to run the report from our software which is written in Delphi, I get an error (Crystal error of queryengineerror).
To narrow it down further, I tried hardcoding the stored procedure to return the same data and ignore the parameters and then have the report show the parameters in the report header. This runs fine from Delphi.
Then I started putting the parameters back in the sproc. I've narrowed the problem down to a single line in the sproc. It is one that takes the parameters for day, month, year and turns them into a date. The syntax seems okay as it runs fine in IBExpert and from Crystal. What we can't figure out is why it fails when called from Delphi. The line in the sproc that is causing the issue is:
DateFrom = castdatefromyear ||'-'|| :datefrommonth ||'-'|| :datefromday as date)
(If I change this to:
DateFrom = cast('2006-1-1' as date)
it works fine)
I'm using this same code in another report and sproc combination and it works fine when called from Delphi.
I'm hoping that someone might be able to shed some light on this. Any thougths?
I hope this is the right forum (wasn't sure if it should be here, in the Interbase forum or in the Delphi forum).
Here is the situation:
I have a Crystal report (v9) that calls a stored procedure in Interbase 7.5.
If I run the stored procedure in IB Expert, it runs fine.
If I run the Crystal report in Crystal and input the parameters, it runs fine.
When trying to run the report from our software which is written in Delphi, I get an error (Crystal error of queryengineerror).
To narrow it down further, I tried hardcoding the stored procedure to return the same data and ignore the parameters and then have the report show the parameters in the report header. This runs fine from Delphi.
Then I started putting the parameters back in the sproc. I've narrowed the problem down to a single line in the sproc. It is one that takes the parameters for day, month, year and turns them into a date. The syntax seems okay as it runs fine in IBExpert and from Crystal. What we can't figure out is why it fails when called from Delphi. The line in the sproc that is causing the issue is:
DateFrom = castdatefromyear ||'-'|| :datefrommonth ||'-'|| :datefromday as date)
(If I change this to:
DateFrom = cast('2006-1-1' as date)
it works fine)
I'm using this same code in another report and sproc combination and it works fine when called from Delphi.
I'm hoping that someone might be able to shed some light on this. Any thougths?