locked
OdbcCommandBuilder.DeriveParameters and MySQL stored procedures RRS feed

  • Question

  • Hi guys,

    I have this stored procedures in MySQL 5.0:

     

    CREATE DEFINER = 'root'@'localhost'
    PROCEDURE classicmodels.GetEmployeeByID(IN ID INT)
    BEGIN
     SELECT * FROM employees WHERE employeeNumber = ID;
    END
    

    In my C# code I need to get the details about the parameter for the stored procedure and I use the OdbcCommandBuilder.DeriveParameters() method in order to do that. Here is my code:

    static void GetParameterList()
    {
      OdbcConnection connection = null;
      string ConnectionString = "Driver={MySQL ODBC 5.1 Driver};Server=taurus;Port=3306;Database=classicmodels;Uid=root;Pwd=12345;Trusted_Connection=yes;";
      string StoredProcedureName = "classicmodels.GetEmployeeByID";
      try
      {
        using (connection = new OdbcConnection(ConnectionString))
        {
          connection.Open();
          OdbcCommand command = connection.CreateCommand();
          command.CommandType = CommandType.StoredProcedure;
          command.CommandText = StoredProcedureName;
    
          OdbcCommandBuilder.DeriveParameters(command);
    
          foreach (OdbcParameter parameter in command.Parameters)
          {
            Console.WriteLine(parameter.ParameterName);
          }
        }
      }
      catch(Exception e)
      {
        Console.WriteLine(e.Message);
      }
    }
    

    But command.Parameters is always equal zero and there is no any exception. How can I get the information about the parameters of MySQL stored procedures?

     


    Dmitry

    Lightning Tools LogoLightning Tools Check out our SharePoint tools and web parts
    • Moved by Larcolais Gong Saturday, August 13, 2011 9:35 AM (From:ADO.NET Managed Providers)
    Wednesday, August 10, 2011 8:47 PM

Answers

All replies