Unanswered: Delphi Newbie stumped by runtime ParamsbyName
OK, I see how to use the IDE to set up a TQuickReport with a TQuery SQL statement using the Parameter Window -- and it runs. 3 of 4 steps there. But my SQL statement is a call to a server-side procedure and I would like to feed different input parameters to the procedure so it brings back data sets from different tables with the same structure.
Looking at a bunch of web sites I've pieced together that I need something like this:
SQLText := 'SELECT * FROM ClusterProcedure(TYPE LIKE :Param1)';
frmRCluster.QreportC.Active := False;
frmRCluster.QreportC.ParamByName(':Param1').Value := GroupNumber;
I've got something that compiles and doesn't cause a runtime error. But it doesn't bring back anything. (the DBfields on the QuickReport are pointing to the appropriate TQuery fields.)
I assume my problem is that I don't have any idea whatsoever what the "forest" should look like. I put the above code in a "beforeOpen" event procedure for the Tquery. Yes? No? Do I have to hand code populating the report data fields now too?
Basically, does anybody know where there is a full example of a QuickReport unit (or any DB unit) using runtime ParamsByName so I can get the big picture of how to code this so all the parts work together?
Try removing the colon from ':Param1' The parameter name is used with a colon in the SQL statement but the actual parameter name for use the ParamsByName method is without the colon. So it should look like ParamsByName('Param1') and NOT ParamsByName(':Param1').