Hi,
I had posted in a Crystal forum, but I think it's more of a Delphi or Interbase issue (not sure if I should post here or in the Interbase forum, so I'm trying here first). Sorry for reposting, but I think this is the better place to post (One person has been trying to help from the other forum, but they don't know Delphi either, so I think people here might be able to help from that side).
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 = cast
datefromyear ||'-'|| :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 don't know a lot about Delphi and am relying on the Delphi developers here for that side. It's looking like it has something to do with the parameters coming from Delphi.
Note: I also just tried putting test = cast
datefromday as integer) since :datefromday is a string parameter containing an integer. This also breaks the sproc - leading me to again feel that there is something odd about the parameter coming from Delphi.
I'm hoping that someone might be able to shed some light on this. Any thoughts?
I had posted in a Crystal forum, but I think it's more of a Delphi or Interbase issue (not sure if I should post here or in the Interbase forum, so I'm trying here first). Sorry for reposting, but I think this is the better place to post (One person has been trying to help from the other forum, but they don't know Delphi either, so I think people here might be able to help from that side).
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 = cast
(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 don't know a lot about Delphi and am relying on the Delphi developers here for that side. It's looking like it has something to do with the parameters coming from Delphi.
Note: I also just tried putting test = cast
I'm hoping that someone might be able to shed some light on this. Any thoughts?