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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delphi+Crystal Reports parameter problem

Status
Not open for further replies.

ByzantianX

Programmer
Dec 18, 2000
103
I've got a SQL Server database, report in Crystal Reports, based on a stored procedure and front-end application in Delphi 7. I use Crystal Report Control (5.2). The problem is that I can't pass the parameters values to the report. Here's the piece of code:

cr:=tcrystalreport.Create(frmMain.cr2);
cr.ReportFileName:=strReportLocation;
cr.StoredProcParam[0]:=strDate1;
cr.StoredProcParam[1]:=strDate2;
cr.PrintReport;

I always get the message:'Invalid number of parameters', although I checked the function RetrieveStoredProcParams
and I'm getting respond that there's 2 stored procedure parameters. Could anyone help, please?
 
I've never used stored procedures before, but if they are anything like other object in Crystal, I belive you have to "retrieve" those procedures before accessing them.

Don't quote me on this, but something like: cr.StoredProcParam.Retrieve;


Paul Wesson, Programmer/Analyst
 
Thank you, I did that already:
cr.RetrieveStoredProcParams;
cr.StoredProcParam[0]:=strDate1;
cr.StoredProcParam[1]:=strDate2;
cr.PrintReport;

But, I keep getting message: 'Invalid number of parameters'.
When I check number of parameters with, for example:
showmessage(inttostr(cr.RetrieveStoredProcParams));
I get respond that there are 2 parameters. So, I guess, that work fine. Is there anything about compatibility with Crystal Report control (5.2) and Crystal Reports 8.5?
 
Yes, I tried that too (in case Crystal make indexes from 1; it wasn't a case before, but, just in case) but it didn't work either. I installed Crystal VCL and now, it works just great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top