Page 1 of 1

storedproc and paramerters

Posted: Wed 08 Aug 2012 16:46
by inageib
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

Re: storedproc and paramerters

Posted: Thu 09 Aug 2012 08:14
by ZEuS
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.

Re: storedproc and paramerters

Posted: Thu 09 Aug 2012 13:35
by inageib
I checked the documentation and did not find this!
Thanks alot