精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
Stored procedure input and output parameters 存储过程的输入和输出参数
SqlConnection con = new SqlConnection(@");
con.Open();
string tdata = String.Empty;
string pno = string.Empty;
SqlCommand cmd = new SqlCommand("gettagdata", con);
//INPUT Parameters输入参数
cmd.Parameters.AddWithValue("@TagId", tagid).Direction = System.Data.ParameterDirection.Input;
//OUTPUT Parameters输出参数
cmd.Parameters.Add("@Tagdata", SqlDbType.VarChar, 500);
cmd.Parameters["@Tagdata "].Direction = ParameterDirection.Output;
cmd.Parameters.Add("@PhoneNumber", SqlDbType.VarChar, 500);
cmd.Parameters["@PhoneNumber"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
tdata = (string)cmd.Parameters["@Tagdata"].Value;
pno = (string)cmd.Parameters["@PhoneNumber"].Value;
client.SendSmsMessage("PHONE NUMBER", pno, "Please click here for your coupons " + tdata);
con.Close();
One input Parameter and after Getting Two out Parameters
一个输入参数和后的两个输出参数
I am writting the above code not geeting output anything wrong this code pls help me
请帮我看看我写出的这段代码有没有任何输出错误
Thank you , your code is good . God bless!谢谢你,你的代码是好的。上帝保佑!