Ejemplo n.º 1
0
        //수정 버튼 눌렀을 떄 실행
        private void update_button_Click(object sender, EventArgs e)
        {
            dbConnect db = new dbConnect();

            string name1  = update_name.Text;
            string price1 = update_price.Text;
            string name2  = update_name2.Text;
            string price2 = update_price2.Text;

            if ((update_name2.Text == "") || (update_name2.Text.Equals("이름 변경")))
            {
                if ((update_price2.Text == "") || (update_price2.Text.Equals("가격 변경")))
                {
                    MessageBox.Show("이름과 가격을 변경하지 않습니다.");
                    db.update(name1, price1, name1, price1);
                }
                else
                {
                    MessageBox.Show("이름을 변경하지 않습니다.");
                    db.update(name1, price1, name1, price2);
                }
            }
            else
            {
                if ((update_price2.Text == "") || (update_price2.Text.Equals("가격 변경")))
                {
                    MessageBox.Show("가격을 변경하지 않습니다.");
                    db.update(name1, price1, name2, price1);
                }
                else
                {
                    MessageBox.Show("이름과 가격을 변경합니다");
                    db.update(name1, price1, name2, price2);
                }
            }
            //Close();
            update_Load(sender, e);
            textboxClear();
        }