1 回答

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超13個(gè)贊
假設(shè)有一個(gè)名為“MyOutParam”的參數(shù),它是outputMySQL 存儲(chǔ)過(guò)程的一種參數(shù)類型。在這種情況下,你需要做的是:
// here goes the logic of instantiating the command for a stored procedure
// cmd is the reference variable containing instance of SQLCommand
cmd.Parameters.Add(new MySqlParameter(“MyOutParam”, MySqlDbType.VarChar));
cmd.Parameters[“MyOutParam”].Direction = ParameterDirection.Output; // this is how we declare the parameter to be of 'output' type.
cmd.ExecuteNonQuery();
// this is how we can get the value in the output parameter after stored proc has executed
var outParamValue = cmd.Parameters[“MyOutParam”].Value;
- 1 回答
- 0 關(guān)注
- 134 瀏覽
添加回答
舉報(bào)