我想在 C# 中调用一个存储函数。为此,我需要文章和一些示例。
最佳答案
它几乎与调用 SQL Server 存储过程的方式相同:
using(MySqlConnection conn = new MySqlConnection(connString))
{
MySqlCommand command = new MySqlCommand("spSomeProcedure;", conn);
command.CommandType = System.Data.CommandType.StoredProcedure;
// Add your parameters here if you need them
command.Parameters.Add(new MySqlParameter("someParam", someParamValue));
conn.Open();
int result = (int)command.ExecuteScalar();
}
关于c# - 如何在 C# 中调用 mySQL 存储函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3228411/