Bug StoredProcedure in dotConnect for MySQL 5.80.152
Posted: Fri 30 Jul 2010 12:57
Hello,
there is a little bug with the parameters of a stored procedure.
The name you set in
is ignored for the stored procedure.
Also the order of the cmd.Parameters.Add()-Commands is important and has to match with the order of parameters of the stored procedure. (also if you give the same name like in the stored procedure)
This means the parameterName of the cmd.Parameters.Add-Command is completely ignored in the sql server.
The original MySQL Connector does it correctly.
Tried it with dotConnect for MySQL 5.80.152 Express Version.
Thanks for that great free
connector
See attached a little bug script.
there is a little bug with the parameters of a stored procedure.
The name you set in
Code: Select all
cmd.Parameters.Add("b"Also the order of the cmd.Parameters.Add()-Commands is important and has to match with the order of parameters of the stored procedure. (also if you give the same name like in the stored procedure)
This means the parameterName of the cmd.Parameters.Add-Command is completely ignored in the sql server.
The original MySQL Connector does it correctly.
Tried it with dotConnect for MySQL 5.80.152 Express Version.
Thanks for that great free
See attached a little bug script.
Code: Select all
DROP PROCEDURE spDevartBug;
DELIMITER //
CREATE PROCEDURE spDevartBug (IN var_1 VARCHAR(50), IN var_2 VARCHAR(50))
BEGIN
SELECT var_1 as var1, var_2 as var2;
END //
DELIMITER ;Code: Select all
using (MySqlConnection con = new MySqlConnection("Server=localhost;Database=test;Uid=test;Pwd=test;")) {
con.Open();
MySqlCommand cmd = new MySqlCommand(
"spDevartBug", con);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add("b", MySqlType.VarChar, 50);
cmd.Parameters.Add("a", MySqlType.VarChar, 50);
cmd.Parameters["a"].Value = "1";
cmd.Parameters["b"].Value = "2";
MySqlDataReader readerData = cmd.ExecuteReader();
readerData.Read();
Console.WriteLine((string)readerData["var1"]);
Console.WriteLine((string)readerData["var2"]);
readerData.Close();
}