Problem with accessing parameters in IBCStoredProc

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
MoonFox
Posts: 4
Joined: Tue 26 Jun 2007 15:09

Problem with accessing parameters in IBCStoredProc

Post by MoonFox » Sun 22 Jul 2007 08:27

Because IBCStoredProc don't store parameter types and names in DFM by default (and automatically determine information during preparation), call ParamByName(XXX) without explicit preparation of stored procedure raise exception 'Parameter 'XXX' not found'.
Setting AutoPrepare in Options property don't solve this problem.
Solution is setting ParamCheck to False, invoke StoredProc editor (by double clicking on component) for preparation, changing editor tab to "Parameters" (parameters list filled automatically) and save form (in this case Params property stored in DFM), or folowing code appendix:

Code: Select all

with IBCStoredProc1 do begin
  if not Prepared then
    Prepare;
  ParamByName(XXX).As... := ...;
.....
  ExecProc;
end;
, but complex application needs too much annoying changes.

FireBird 2.01, Delphi 7, IBDac 2.10.0.9

PS: sorry for my "english"!

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Tue 24 Jul 2007 07:12

We couldn't reproduce the problem with "IBCStoredProc don't store parameter types and names in DFM by default", please describe steps to reproduce in more details, or send us a small demo project with a script to create server-side objects.
To obtain stored procedure parameters in run-time, it is better to use the IBCStoredProc.PrepareSQL(IsQuery) method, but if you setup IBCStoredProc in design-time, all parameters should be in the IBCStoredProc.Params list.

MoonFox
Posts: 4
Joined: Tue 26 Jun 2007 15:09

Post by MoonFox » Tue 24 Jul 2007 09:55

Sorry, my mistake!
I convert large project from BDE to IBDac by hands and only setting ProcName property of TIBCStoredProc at design-time.
Double click on component for preparation and click OK button - and, voila! DFM now contains all stored procedure parameters. No more problems!
Thanks for fast feedback!

Post Reply