Bug #69159 Error when calling routine with NATIONAL VARCHAR(SIZE) parameters definition
Submitted: 6 May 2013 18:01 Modified: 8 May 2013 4:20
Reporter: Gabriela Martinez Sanchez Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.6.5 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: c6.6.5

[6 May 2013 18:01] Gabriela Martinez Sanchez
Description:
When calling a routine that has NATIONAL VARCHAR parameters instead of only VARCHAR, this results in a MySqlException "Incorrect number of arguments for PROCEDURE expected 2, got 1" when executing from the .net code.

How to repeat:
Create a procedure with the following MySql Code:

CREATE DEFINER=`root`@`localhost` PROCEDURE `testing`(somepar varchar(100) CHARACTER SET utf8, secondpar  varchar(50) CHARACTER SET utf8)
    READS SQL DATA
BEGIN
    //Some select here
END

From the .net code call the above procedure with the following code:

       conn.Open();

      var cmd = new MySqlCommand("testing");
      cmd.CommandType = CommandType.StoredProcedure;
      cmd.Connection = conn;
      string pass = "somepass";
      string email = "someemail";

      MySqlParameter pramEmail = new MySqlParameter("@somepar", email);
      pramEmail.Direction = ParameterDirection.Input;
      cmd.Parameters.Add(pramEmail);

      MySqlParameter pramPassword = new MySqlParameter("@secondpar", pass);
      pramPassword.Direction = ParameterDirection.Input;
      cmd.Parameters.Add(pramPassword);

      var value = cmd.ExecuteScalar();
      conn.Close();

Actual results:

A MySqlException is thrown when Executing the command.

Suggested fix:
Fix the storedprocedure.cs code so all the parameters are correctly added.
[8 May 2013 4:20] Gabriela Martinez Sanchez
The bug has been duplicated with this one: 

http://bugs.mysql.com/bug.php?id=69152