On 30 May 2001, at 9:21, James Low wrote:

> My stored procedure (below) wont work. When I call execproc I get either a
> parameter or type mismatch or I am told there is no Params[0] - the return
> value. The generator it uses has not incremented.
> 
> I have an IB Insert TRigger that correctly uses the generator to fill in a
> Null field value when I post but now want to use the stored procedure to
> pass in a non-null value (which is so much more convenient).
> 
> Heres my ISQL script (Set term $;) for the procedure, ISQL tells me it is on
> the server (but I do not know how to test it other than through Delphi).
>   
> CREATE PROCEDURE PRO_GETSLPRTY
> RETURNS (ID_SLPRTY INTEGER)
> AS
> BEGIN
> ID_SLPRTY = gen_id(GEN_SLPRTY, 1);
> END $
> COMMIT$
> 
> The stored Procedure is called onInsert:
> 
> begin
>     With StoredProc do begin
>         myParamname := RETPREFIX + Tablename;
>         StoredProcName := SPPREFIX + Tablename;
>         Params.AddParam(Params.CreateParam(ftInteger, myParamname,
> ptInput));
>         Prepare;
>         ExecProc;
> // raises DB error here.
> 
> Result := ????;//would have thought Params[0] or ParambyName(myParamname)
> ... but the program advises me there are no params.
>      end;
> end;
> 
Thats because u r trying to pass a input parameter which doesn't 
exist in the stored procedure.

U need to execute the SP and  do StoredProc.Fields[0].AsInteger 
to get the value.


Sandeep

Software Developer
CFL
[EMAIL PROTECTED]
http://www.cfl.co.nz

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to