0
이 경우 및 인벤토리 범주의 값을 반환하는 쿼리가 있습니다. 사용자가 특정 상자 번호를 입력하면 양식에서 사용할 수있는 것이면 양식이 사용 불가능하게됩니다. 문제는 ExecuteScalar를 사용하고 그 값을 문자열 "AP"와 비교해야한다는 것입니다. 나는 C#에 익숙하지 않고 이것을 수행하는 방법을 알 수 없다. 여기까지 내 코드는 다음과 같습니다.if 문에서 변수와 개체 비교 C#
private void hide_apple_controls()
{
SqlCommand cmd = new SqlCommand();
Object invCat;
cmd.CommandText = "SELECT itm.inv_cat FROM " +
"t_item_master itm " +
"LEFT OUTER JOIN t_box box (NOLOCK) ON box.product_code LIKE itm.item_number " +
"where box.box_id = @box_id ";
cmd.Parameters.Add("@box_id", SqlDbType.VarChar).Value = boxBox.Text;
cmd.CommandType = CommandType.Text;
cmd.Connection = this.sqlConnection1;
this.sqlConnection1.Open();
SqlDataAdapter adpt = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adpt.Fill(ds);
invCat = cmd.ExecuteScalar();
this.sqlConnection1.Close();
string ap = "AP";
if (invCat == ap)
{
disable_qc_form();
}
enable_qc_form();
}
문제가 해결되면 답변 해주세요. – Madushan