亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何從 ASP.NET 中的 Mysql 存儲過程調用輸出參數

如何從 ASP.NET 中的 Mysql 存儲過程調用輸出參數

C#
拉丁的傳說 2023-07-22 16:37:35
我在將輸出參數從 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;


查看完整回答
反對 回復 2023-07-22
  • 1 回答
  • 0 關注
  • 121 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號