If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Delphi Newbie stumped by runtime ParamsbyName

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-13-05, 21:33
smchris smchris is offline
Registered User
 
Join Date: Feb 2004
Posts: 3
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.SQL.Clear;
frmRCluster.QreportC.SQL.Add(SQLText);
frmRCluster.QreportC.ParamByName(':Param1').Value := GroupNumber;
frmRCluster.QreportC.Active:= True;

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?

TIA
Reply With Quote
  #2 (permalink)  
Old 01-28-05, 08:36
jkhartnett jkhartnett is offline
Registered User
 
Join Date: Oct 2004
Posts: 2
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').
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On