private void ucMaterialLog_Load(object sender, EventArgs e) { DataTable dt = BLL_Bllb_MaterialLog_tbml.BindOperateType(); DataRow dr = dt.NewRow(); dr["OperateType"] = string.Empty; dr["OperateType"] = string.Empty; dt.Rows.InsertAt(dr, 0); cbo_operateType.DataSource = dt; cbo_operateType.DisplayMember = "OperateType"; cbo_operateType.ValueMember = "OperateType"; }
private void Query() { string strWhere = " Where 1=1"; if (txt_serialNumber.Text != string.Empty) { strWhere += string.Format(" And SerialNumber='{0}'", txt_serialNumber.Text.Trim()); } if (txt_materialCode.Text != string.Empty) { strWhere += string.Format(" And MaterialCode='{0}'", txt_materialCode.Text.Trim()); } if (cbo_operateType.SelectedValue.ToString() != string.Empty) { strWhere += string.Format(" AND OperateType='{0}'", cbo_operateType.SelectedValue.ToString()); } DataTable dt_materialLog = BLL_Bllb_MaterialLog_tbml.Select(strWhere); dgv_materialLog.DataSource = dt_materialLog; }