这个存储过程在winform中如何调用??
CREATEprocgx@ssvarchar(20),@ttvarchar(20)asdeclare@hhvarchar(20)select@hh=IDfromzskcc...
CREATE proc gx
@ss varchar(20),
@tt varchar(20)
as
declare @hh varchar(20)
select @hh=ID from zskcc where mc=@ss
update zskcc set PID=@hh where mc=@tt
GO
ss 和tt是要传递的参数。多谢! 展开
@ss varchar(20),
@tt varchar(20)
as
declare @hh varchar(20)
select @hh=ID from zskcc where mc=@ss
update zskcc set PID=@hh where mc=@tt
GO
ss 和tt是要传递的参数。多谢! 展开
2个回答
展开全部
SqlConnection conn = new SqlConnection("连接字符串");
cmd = new SqlCommand("gx",conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@ss", ss的值);
cmd.Parameters.AddWithValue("@tt", tt的值);
if (cmd.Connection.State == ConnectionState.Closed) cmd.Connection.Open();
cmd.ExecuteScalar();
if (cmd.Connection.State == ConnectionState.Open) cmd.Connection.Close();
cmd.Dispose();
conn.Dispose();
cmd = new SqlCommand("gx",conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@ss", ss的值);
cmd.Parameters.AddWithValue("@tt", tt的值);
if (cmd.Connection.State == ConnectionState.Closed) cmd.Connection.Open();
cmd.ExecuteScalar();
if (cmd.Connection.State == ConnectionState.Open) cmd.Connection.Close();
cmd.Dispose();
conn.Dispose();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询