 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
RobGeezer Guest
|
Posted: Thu Jan 12, 2006 11:15 am Post subject: Stored procedure 0 result mystery |
|
|
We have to use InterBase via ODBC for this project. Using ADO the
stored procedure returns 0. Testing using InterBase components
directly, the stored procedure gives the right value. ADO does call
the procedure - just loses the result. Has anyone solved this problem
please?
Delphi 2005, MDAC 2.8, Easysoft ODBC 4.0.0.7, InterBase 7.5
Stored procedure/generator SQL:
CREATE GENERATOR CALLREF_GENERATOR;
SET GENERATOR CALLREF_GENERATOR TO 1
CREATE PROCEDURE GETNEWCALLREF RETURNS (
RETURNVALUE INTEGER
) AS
begin
RETURNVALUE = gen_id(CALLREF_GENERATOR, 1);
end
Delphi 2005 code:
procedure TForm1.btnAdoClick(Sender: TObject);
var
number: integer;
begin
ADOStoredProc1.Parameters.Clear;
ADOStoredProc1.Parameters.CreateParameter('RETURNVALUE', ftInteger,
pdOutput{pdReturnValue}, 4, 0);
ADOStoredProc1.ExecProc;
number := ADOStoredProc1.Parameters.ParamByName('RETURNVALUE').Value;
memo1.Lines.Add('Returns=' + inttostr(number));
end;
// Using pdReturnValue causes exception "parameter mismatch"
procedure TForm1.btnInterBaseClick(Sender: TObject);
var
number: integer;
begin
IBStoredProc1.Params.Clear;
IBStoredProc1.Params.CreateParam(ftInteger, 'RETURNVALUE',
{ptResult}ptOutput);
IBStoredProc1.ExecProc;
number := IBStoredProc1.ParamByName('RETURNVALUE').Value;
memo2.Lines.Add('Returns=' + inttostr(number));
end;
// using ptResult causes InterBase to return 0 as well!!
|
|
| Back to top |
|
 |
RobGeezer Guest
|
Posted: Thu Jan 12, 2006 11:36 am Post subject: Re: Stored procedure 0 result mystery |
|
|
Hi. There's a typographical error. The ADO example function should be
as follows:
ADOStoredProc1.Parameters.CreateParameter('RETURNVALUE', ftInteger,
{pdOutput}pdReturnValue, 4, 0);
and:
// Using pdOutput causes exception "parameter mismatch"
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|