hi all,
would you please put an example in Delphi wich takes a result set from a MySQL stored procedure(which has got a select in it) ?
and another one which uses OUT parameter of an SP?
i've installed mysqldirect but i can not use it properly.
Thanks in advance
Chagh
using result set of an SP in Delphi code
Here ia an example in Delphi wich takes a result set from a MySQL stored procedure called "MR".MySql protocol does not supports returning OUT parameters to client side. You can use them only at server side.
Code: Select all
procedure TWinForm.Button2_Click(sender: System.Object; e: System.EventArgs);
var
connection: MySqlConnection;
command: MySqlCommand;
dataAdapter: MySqlDataAdapter;
ds: DataSet;
begin
connection := MySqlConnection.Create('host=server;port=3308;database=test;user id=root;password=root;');
command := MySqlCommand.Create('MR', connection);
command.CommandType := CommandType.StoredProcedure;
dataAdapter := MySqlDataAdapter.Create(command);
ds := DataSet.Create();
connection.Open();
try
dataAdapter.Fill(ds);
DataGrid1.DataSource := ds;
finally
connection.Close();
end;
end;
Code: Select all
CREATE PROCEDURE test.MR()
BEGIN
select * from emp;
select * from dept;
END;