本文介绍了请澄清以下'param1'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public void GetPositionName(字符串 PosCode)
{
如果(cn.State == ConnectionState.Open)
{
cn.Close();
}
cn.Open();
lblConnectionState.Text = CONNECTED;
cmd.Connection = cn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = GET_POSITION_NAME;
SqlParameter param1 = new SqlParameter();
param1.ParameterName = POSITION_CODE;
param1.Direction = ParameterDirection.Input;
param1.SqlDbType = SqlDbType.VarChar;
param1.Value = PosCode;
param1.Value =会话[ selected_position_code];
cmd.Parameters.Add(param1);
da.SelectCommand = cmd;
da.Fill(ds);
DataTable dt = ds.Tables [ 0 ];
lblPositionName.Text = dt.Rows [ 0 ] [ POSITION_NAME]。ToString( );
}
请澄清代码的粗体部分SqlParameter和param1
解决方案
public void GetPositionName(string PosCode) { if (cn.State == ConnectionState.Open) { cn.Close(); } cn.Open(); lblConnectionState.Text = "CONNECTED"; cmd.Connection = cn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "GET_POSITION_NAME"; SqlParameter param1 = new SqlParameter(); param1.ParameterName = "POSITION_CODE"; param1.Direction = ParameterDirection.Input; param1.SqlDbType = SqlDbType.VarChar; param1.Value = PosCode; param1.Value = Session["selected_position_code"]; cmd.Parameters.Add(param1); da.SelectCommand = cmd; da.Fill(ds); DataTable dt = ds.Tables[0]; lblPositionName.Text = dt.Rows[0]["POSITION_NAME"].ToString(); }
Kindly clarify the boldened portion of the codes "SqlParameter" and 'param1'
解决方案
这篇关于请澄清以下'param1'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!