Page 1 of 1

Problem with accessing parameters in IBCStoredProc

Posted: Sun 22 Jul 2007 08:27
by MoonFox
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"!

Posted: Tue 24 Jul 2007 07:12
by Alex
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.

Posted: Tue 24 Jul 2007 09:55
by MoonFox
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!