Ejemplo n.º 1
0
        /*
         * private void DeleteData()
         * {
         *  try
         *  {
         *      using (MySqlConnection conn = new MySqlConnection(Commons.CONNSTR))
         *      {
         *          conn.Open();
         *          MySqlCommand cmd = new MySqlCommand();
         *          cmd.Connection = conn;
         *          cmd.CommandText = "DELETE FROM divtbl" +
         *                            " WHERE Division = @Division ";
         *          MySqlParameter paramDivision = new MySqlParameter("@Division", MySqlDbType.VarChar);
         *          paramDivision.Value = TxtDivision.Text;
         *          cmd.Parameters.Add(paramDivision);
         *
         *          cmd.ExecuteNonQuery();
         *
         *          if (myMode == BtnMode.INSERT)
         *          {
         *              MetroMessageBox.Show(this, $"구분코드 {paramDivision.Value}가 삭제되었습니다.", "삭제");
         *              myMode = BtnMode.NONE;
         *          }
         *      }
         *  }
         *  catch (Exception ex)
         *  {
         *      MetroMessageBox.Show(this, $"에러발생 {ex.Message}", "에러", MessageBoxButtons.OK, MessageBoxIcon.Error);
         *  }
         *  finally
         *  {
         *      UpdateData();
         *  }
         * }
         */
        #endregion

        private void BtnCancel_Click(object sender, EventArgs e)
        {
            TxtDivision.Text     = string.Empty;
            TxtNames.Text        = string.Empty;
            TxtDivision.ReadOnly = false;

            myMode = BtnMode.NONE; // 모드 초기화

            GrdDivTbl.Focus();
        }
Ejemplo n.º 2
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            if (myMode != BtnMode.UPDATE)
            {
                MetroMessageBox.Show(this, $"삭제할 데이터를 선택하세요.", "알림");
                return;
            }

            myMode = BtnMode.DELETE;
            //DeleteData();
            SaveData();
            InitControls();

            GrdDivTbl.Focus();
        }