Using the following code:
MySqlParameter curParam = new MySqlParameter("var", MySqlDbType.Int32);
curParam.Direction = System.Data.ParameterDirection.Output;
oCmd.Parameters.Add(curParam);
With the following Stored Procedure:
CREATE PROCEDURE testProc(OUT var INT)
BEGIN
SELECT 1, 2, 3;
SELECT 27 INTO var;
END
$$
Running this from the console returns "27":
CALL testProc(@i);
SELECT @i;
However in .NET, when executing the query (when the connection is still open), curParam.value returns NULL.
The stored procedure otherwise returns the correct results. Additionally, when running the Stored Procedure directly in the console, the output param returns correctly as well.
Am I missing something?