storedproc and paramerters

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
inageib
Posts: 184
Joined: Wed 26 Aug 2009 14:11

storedproc and paramerters

Post by inageib » Wed 08 Aug 2012 16:46

Hi,
I have a stored procedure in a firebird db like this:

Code: Select all

create or alter procedure MyPROC (
    P1 integer,
    P2 integer)
as
begin
  Insert into table1 (f1, f2, f3)
  select :p2, f2, f3
  from table1 where f1 = :p1;

end^
I use this procedure to copy same records but with different foreign key however when I use the TIBCStoredProc and assign parameters using "ParamByName" I get error parameter does not exists

I use these code in Delphi:

Code: Select all

myStoredProc.StoredProcName := 'MyPROC';
myStoredProc.ParamByName('p1').AsInteger := var1;
myStoredProc.ParamByName('p2').AsInteger := var2;

myStoredProc.ExecProc;
please advise

thanks
Last edited by inageib on Thu 09 Aug 2012 13:36, edited 1 time in total.

ZEuS
Devart Team
Posts: 240
Joined: Thu 05 Apr 2012 07:32

Re: storedproc and paramerters

Post by ZEuS » Thu 09 Aug 2012 08:14

After setting the stored procedure name, you should execute the myStoredProc.PrepareSQL(False) method before setting parameter values in order to let the TIBCStoredProc component describe the parameters of the stored procedure.

inageib
Posts: 184
Joined: Wed 26 Aug 2009 14:11

Re: storedproc and paramerters

Post by inageib » Thu 09 Aug 2012 13:35

I checked the documentation and did not find this!
Thanks alot

Post Reply