C# 怎么调Mysql带inout参数的存储过程? 5
procedureprc(inaint,outbint,inoutcint)begin........endC#怎么调这个存储过程?...
procedure prc(in a int,out b int,inout c int)
begin
........
end
C#怎么调这个存储过程? 展开
begin
........
end
C#怎么调这个存储过程? 展开
2个回答
2015-12-08
展开全部
string MyConString = "..."
OdbcConnection conn = new OdbcConnection(MyConString);
conn.Open();
OdbcCommand cmd = new OdbcCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "p_test";
OdbcParameter p1 = new OdbcParameter("t_count", OdbcType.Int);
p1.Direction = ParameterDirection.Output;
cmd.Parameters.Add(p1);
int i = cmd.ExecuteNonQuery();
TextBox1.Text = p1.Value.ToString();
conn.Close();
OdbcConnection conn = new OdbcConnection(MyConString);
conn.Open();
OdbcCommand cmd = new OdbcCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "p_test";
OdbcParameter p1 = new OdbcParameter("t_count", OdbcType.Int);
p1.Direction = ParameterDirection.Output;
cmd.Parameters.Add(p1);
int i = cmd.ExecuteNonQuery();
TextBox1.Text = p1.Value.ToString();
conn.Close();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询