How can I get an OUT parameter

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jalin
Posts: 23
Joined: Tue 18 Mar 2008 14:45

How can I get an OUT parameter

Post by jalin » Fri 30 May 2008 02:27

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

jkuiper_them
Posts: 28
Joined: Thu 20 Dec 2007 14:48

Post by jkuiper_them » Mon 02 Jun 2008 13:51

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?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 03 Jun 2008 08:10

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;

Post Reply