using (SqlConnection sqlconn = new SqlConnection("server=.;uid=sa;pwd=yuling1310;database=smls"))
{
SqlCommand sqlcmd = new SqlCommand("getcerti_notesbigtext", sqlconn);
sqlcmd.CommandType = CommandType.StoredProcedure;
//输入参数
sqlcmd.Parameters.Add("p_certi_type_code", SqlDbType.VarChar, 10).Value = "x";
sqlcmd.Parameters.Add("p_order_no", SqlDbType.VarChar, 50).Value = "SBF55YQ001";
sqlcmd.Parameters.Add("@p_certi_no", SqlDbType.VarChar, 50).Value = "00000155";
sqlcmd.Parameters.Add("@a_certi_sheet_type_code", SqlDbType.VarChar, 10).Value = "1";
//输出参数
sqlcmd.Parameters.Add("@text1", SqlDbType.VarChar, 200);
sqlcmd.Parameters["@text1"].Direction = ParameterDirection.Output;
sqlcmd.Parameters.Add("@text2", SqlDbType.VarChar, 200);
sqlcmd.Parameters["@text2"].Direction = ParameterDirection.Output;
sqlcmd.Parameters.Add("@text3", SqlDbType.VarChar, 200);
sqlcmd.Parameters["@text3"].Direction = ParameterDirection.Output;
sqlcmd.Parameters.Add("@text4", SqlDbType.VarChar, 200);
sqlcmd.Parameters["@text4"].Direction = ParameterDirection.Output;
sqlconn.Open();
sqlcmd.ExecuteNonQuery();
string str = sqlcmd.Parameters["@text1"].Value.ToString();
sqlconn.Close();
}
{
SqlCommand sqlcmd = new SqlCommand("getcerti_notesbigtext", sqlconn);
sqlcmd.CommandType = CommandType.StoredProcedure;
//输入参数
sqlcmd.Parameters.Add("p_certi_type_code", SqlDbType.VarChar, 10).Value = "x";
sqlcmd.Parameters.Add("p_order_no", SqlDbType.VarChar, 50).Value = "SBF55YQ001";
sqlcmd.Parameters.Add("@p_certi_no", SqlDbType.VarChar, 50).Value = "00000155";
sqlcmd.Parameters.Add("@a_certi_sheet_type_code", SqlDbType.VarChar, 10).Value = "1";
//输出参数
sqlcmd.Parameters.Add("@text1", SqlDbType.VarChar, 200);
sqlcmd.Parameters["@text1"].Direction = ParameterDirection.Output;
sqlcmd.Parameters.Add("@text2", SqlDbType.VarChar, 200);
sqlcmd.Parameters["@text2"].Direction = ParameterDirection.Output;
sqlcmd.Parameters.Add("@text3", SqlDbType.VarChar, 200);
sqlcmd.Parameters["@text3"].Direction = ParameterDirection.Output;
sqlcmd.Parameters.Add("@text4", SqlDbType.VarChar, 200);
sqlcmd.Parameters["@text4"].Direction = ParameterDirection.Output;
sqlconn.Open();
sqlcmd.ExecuteNonQuery();
string str = sqlcmd.Parameters["@text1"].Value.ToString();
sqlconn.Close();
}
SqlParameter[] param = { new SqlParameter("@userid", SqlDbType.Char, 10) };
param[0].Value = userid;
SqlParameter[] param = { new SqlParameter("@userid", SqlDbType.Char, 10),new SqlParameter("@username",SqlDbType.Char, 15),.. };
param[0].Value = userid;
param[1].Value = username;
if (parm != null)
{
foreach (SqlParameter sqlparams in parm)
cmd.Parameters.Add(sqlparams);
}
param[0].Value = userid;
SqlParameter[] param = { new SqlParameter("@userid", SqlDbType.Char, 10),new SqlParameter("@username",SqlDbType.Char, 15),.. };
param[0].Value = userid;
param[1].Value = username;
if (parm != null)
{
foreach (SqlParameter sqlparams in parm)
cmd.Parameters.Add(sqlparams);
}
来源:https://www.cnblogs.com/perfect/archive/2008/05/26/1207454.html