'.Net5 Call stored procedure in MySql with OUT parameter

I'm trying to call a Stored Procedure in MySql that returns a list of rows and with OUT parameter. Code:

using (MySqlConnection conn = new MySqlConnection("server=***;database=***;uid=***;pwd=***;"))
{
   conn.Open();
   using var command = conn.CreateCommand();
   command.CommandText = "CALL p_detail_get";
   command.CommandType = CommandType.StoredProcedure;
   command.Parameters.AddWithValue("@FilterJson", JsonConvert.SerializeObject(input));
   command.Parameters.Add("@Output", MySqlDbType.Int32);
   command.Parameters["@Output"].Direction = ParameterDirection.Output;
   command.ExecuteNonQuery();
}

Error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CALL p_detail_get('{"id":1}', @outParam1);SELECT '' AS '', @outParam1' at line 1

Can you give me an example of the code that can get both - return from procedure and OUT parameter?

Thank you for any help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source