Subject Re: [IBO] TIBOStored procedure returning no fields
Author Helen Borrie
At 02:32 PM 20-10-01 +1200, James Low wrote:
>...try as I may I cannot get the TIBOSToredProc component to
>execute it and return the result. I am using TIBODatabase (active in Design and at
>runtime), dialect 1, and all the default settings for this component. MY stored proc
>is executed as follows (it exists on a datamodule):
>with StoredProc do begin
>StoredProcName := SPPREFIX + Tablename; //This is correct.
> try
> Prepare;
> Execproc;
> Result := StoredProc.Fields[0].AsInteger;
> finally
> //nothing to do here at this stage
> end;
> end;
>What am I missing ... I get a list out of bounds (ie there are no fields returned)when
>I run, and "Error creating cursor handle" if I try to make the StoredProc
>active at design time (probably silly to try). The storedProc has databasename set

TIBOStoredProc emulates TStoredProc so it returns output parameters to the Params[] array, not Fields[].

Because the Params are not created at design time, you may still find that you need add a line after the Prepare to tell Delphi that the parameter is ptOutput.

You don't actually need a function like this in IBO. You can call the Gen_ID(GeneratorName, Increment) method of the TIBODatabase to get the next value of any generator.


All for Open and Open for All
InterBase Developer Initiative ยท