Mmm - the problem appears to be with the BDE/ODBC. IBX works just fine (no
need to create a Parameter - it simply gets returned as Param[0]). May be a
good time to switch to IBO.
-----Original Message-----
From: James Low [mailto:[EMAIL PROTECTED]]
Sent: 30 May 2001 10:45
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Interbase/Delphi Stored Procedure
I had thought the ID_SLPRTY was the Parameter, but can see also that it is a
return value so will try getting at it via fields[0].asIniteger.
Thanks all for your help/suggestions.
-----Original Message-----
From: Sandeep [mailto:[EMAIL PROTECTED]]
Sent: 30 May 2001 09:35
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Interbase/Delphi Stored Procedure
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"
---------------------------------------------------------------------------
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"
---------------------------------------------------------------------------
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"