Return a Result set from a Mysql storeProcedure

Asked

Viewed 232 times

0

Good afternoon.
I have the following storedprocedure in Mysql..:

DELIMITER $$    
CREATE DEFINER=`ricardo`@`%` PROCEDURE `teste2`()
BEGIN   
Select * from Tabela;    
END

As I call this storedprocedure by DELPHI 7 ?
I’m using the ZEOS components.
I’ve tried with the zQuery..: Call teste2; open.. exeqsql.. didn’t work.
I’ve tried with the Zstoredproc1.. also did not work.. it neither click on the properti the name of the storedprocedure.
I know I could do a direct sql in the component, but the one described above is just an example. Procedure performs several operations and at the end there is an sql to be returned.
However, even in the above example, a simple sql, could not return the storedprocedure in Delphi to be viewed in a grid.
Thank you for your attention :)

  • Use Open(); instead of ExecSQL; (use Query)

  • Good afternoon @Sami . As I mentioned in the post, I have tried to use both the open and the exeqsql with several different instructions inside, but without success.. Anyway. Thank you for your attention :)

  • You must use "Active"

1 answer

0

If the stored procedure returns a cursor to be used with visual data controls, add a data source component to the data module and define its Dataset property as the data set of the stored procedure type. Connect data recognition components to the data source using your Datasource and Datafield properties.

You should use "Active" Property of the "StoredProcedure"

ZStoredProc1.Prepare;
ZStoredProc1.Active:= True;

Reference

  • Hi. Thank you for your Attention. But this Component don’t have prepare methodh (for this verssion ) and the Property active is the same that open and don’t work

Browser other questions tagged

You are not signed in. Login or sign up in order to post.