private void btnSave_Click(object sender, EventArgs e) { try { wnDm wDm = new wnDm(); string loc = ""; if (cmb_tmp_loc.SelectedIndex != 0) { loc = cmb_tmp_loc.SelectedValue.ToString(); } if (!lbl_input_gubun.Text.ToString().Equals("1")) { int rsNum = wDm.insert_counter_code( txtCode.Text.ToString() , txtName.Text.ToString() , loc ); if (rsNum == 0) { MessageBox.Show("성공적으로 등록하였습니다."); lbl_input_gubun.Text = "1"; selectGrid(); return; } else if (rsNum == 1) { MessageBox.Show("저장에 실패하였습니다."); return; } else { MessageBox.Show("sql Exception"); return; } } else { int rsNum = wDm.Update_counter_code( txtCode.Text.ToString() , txtName.Text.ToString() , loc ); if (rsNum == 0) { MessageBox.Show("성공적으로 수정하였습니다."); lbl_input_gubun.Text = "1"; selectGrid(); return; } else if (rsNum == 1) { MessageBox.Show("수정에 실패하였습니다."); return; } else { MessageBox.Show("sql Exception"); return; } } } catch (Exception ex) { MessageBox.Show("EXception 오류 발생"); return; } }