Stored Procedures

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sandro.carrara
Posts: 4
Joined: Wed 02 Jun 2010 11:27

Stored Procedures

Post by sandro.carrara » Wed 02 Jun 2010 20:48

Hi, I'm using trial version to understand if MyDAC has same feature I need for my projects.

I've have a first question:
where can I find an example of TMyStoredProc that uses inpèut and output parameters?

Delphi 2007
MySQL 5.1.4

Thanks

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

Post by Dimon » Thu 03 Jun 2010 09:31

You need only to define the StoredProcName property, and parameters for a stored procedure will be created automatically.
The example of code for using parameters of stored procedure:

Code: Select all

  MyStoredProc.StoredProcName := ProcName;
  MyStoredProc.ParamByName(InputParameter).AsInteger := 1;
  MyStoredProc.ExecProc;
  Value := MyStoredProc.ParamByName(OutputParameter).AsString;

sandro.carrara
Posts: 4
Joined: Wed 02 Jun 2010 11:27

Post by sandro.carrara » Sat 12 Jun 2010 09:47

My problem is that the program doesn't recognize the paramaters (neither input or outpu).
I can see them in MyStoredProc Editor.
If I set the input value in editor it works but if I set it in Delphi program I receive the error: Parameter 'input_parameter' not found.


Thanks

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

Post by Dimon » Mon 14 Jun 2010 12:37

To solve the problem call TMyStoredProc.PrepareSQL before setting parameter values.

Post Reply