Page 1 of 1

How can I get an OUT parameter

Posted: Fri 30 May 2008 02:27
by jalin
Delphi 6

I have the following store procedure


CREATE PROCEDURE `Usuario`(OUT xUser char(30)) NO SQL

begin
set xUser =SESSION_USER;
end $$

And I call the procedure from an OnNewRecord or BeforPost event in D6 with the following code

with SUsuario do begin
Execute;
ShowMessage(Params.ParamByName('xUser').AsString);
end;

And Im getting the error code 1414

#42000 Out or InOut Argument 1 for routine Usuario is not a variable or NEW pseudo-variable in before trigger

What am I missing ?

Sorry if many times I cant explain my problems but my english is poor.

Thanks
Jalin

Posted: Mon 02 Jun 2008 13:51
by jkuiper_them
Create a param in the parameterlist, so that Delphi knows there is an OUT parameter available. What do you use to store your procedure; myquery or mystoredproc?

Posted: Tue 03 Jun 2008 08:10
by Dimon
For executing stored procedure you should use the TMyStoredProc component and set the TMyStoredProc.StoredProcName property to 'Usuario'.
After that you can use the following code:

Code: Select all

  with MyStoredProc do begin
    Execute;
    ShowMessage(Params.ParamByName('xUser').AsString);
  end;