c# - 如何设置mysqldataadapter的输出参数

标签 c# mysql .net dataadapter

p_maxsi 是一个输出参数,但不知道如何将其告诉.net..

 MySqlDataAdapter msdadapter = new MySqlDataAdapter("usp_NewItemId_test", mysqlcon);
 msdadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
 msdadapter.SelectCommand.Parameters.Add("p_maxsi", MySqlDbType.Decimal);
 // output parameter how
 msdadapter.Fill(dtbl);

请帮助 .NET 新手

最佳答案

您可以尝试使用MySqlDataAdapter,就像我们使用SqlDataAdapter一样:

//Create the parameter 
 SqlParameter parameter = new SqlParameter("p_maxsi", SqlDbType.VarChar);

//Set the parameter direction as output
parameter.Direction = ParameterDirection.Output;

sqlCommand.Parameters.Add(parameter);

SqlDataAdapter sqlAdapter = new SqlDataAdapter(sqlCommand);
sqlAdapter.Fill(dataSet);

//Fetch the output parameter after doing the Fill

string outputValue = Convert.ToString(parameter.Value);

关于c# - 如何设置mysqldataadapter的输出参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19924790/

相关文章:

c# - 对象实例化异常。初始化成员会发生什么?

c# - 使用 Unity 注册 Mock 对象的问题

c# - 如何用引号引起来的整数C#?

C# - 获取对对象的引用数

mysql - 如何检查 MySQL 触发器中 OLD.* 到 NEW.* 列中每个列的差异?

mysql - 使用 Flash ActionScript 3.0 解析 XML 内容

c# - winmd 文件的版本 255.255.255.255 表示什么?

.net - 自动化 IVR 回归测试

c# - 如何在 C# 反射中列出当前类的字段(this.GetType() 的问题)?

php - 使用范围和关系计算两行 (Laravel)