Page 1 of 1

How to retrieve values from a Stored Procedure

Posted: Wed 21 Nov 2007 10:03
by Zsolt Csillag
Hello,

I have a stored procedure as follows:

CREATE DEFINER = 'root'@'localhost' PROCEDURE `Get_MyValue`(IN cnr cHAR(10))
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN

Select cbk_category from cbk
Where cbk_cnr=cnr;

END;


If I call this procedure from an sql statement like this:

Call Get_MyValue("S10155")

Then I can see every row displayed (like the result of a normal Select).

How can I retrieve the rows (because there might be many rows) from Delphi, calling the stored procedure?



The following code doesn't work, it will never enter in the iteration:

while not eof do
Begin
ShowMessage(FieldByName('cbk_category ').AsString);

Next;
end;

I use Delphi 2006 and MyDac 4.40.0.24.

If my version is not capable to do that but the version 5 is, than I am willing to upgrade.

By the way how can I see the difference between the version 4 and 5?
When should I expect the version 6? If it is not so far it would be easier for me to upgrade directly to 6.

Thank you in advance

Posted: Wed 21 Nov 2007 12:42
by Antaeus
This code should work both in MyDAC 4.40 and MyDAC 5.20.
Please make sure that your TMyQuery calling this procedure is active and that it returns rows.
If it does, try to add a call to the First method before the cycle.
Zsolt Csillag wrote:By the way how can I see the difference between the version 4 and 5?
You can refer to this page: http://crlab.com/mydac/history.html
Zsolt Csillag wrote:When should I expect the version 6? If it is not so far it would be easier for me to upgrade directly to 6.
We have no estimate of MyDAC 6. So you can upgrade to MyDAC 5.