我在將輸出參數從 Mysql 存儲過程返回到 ASP.NET 變量時遇到問題。我只想在 ASP 中使用 ligne 代碼來獲取該參數!謝謝
1 回答

慕田峪7331174
TA貢獻1828條經驗 獲得超13個贊
假設有一個名為“MyOutParam”的參數,它是outputMySQL 存儲過程的一種參數類型。在這種情況下,你需要做的是:
// 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 關注
- 121 瀏覽
添加回答
舉報
0/150
提交
取消