private void btn_Update_Click(object sender, EventArgs e)
        {
            bool state = false;

            updateID = tb_userID.Text;

            conn = new MySqlConnection(strConn);
            conn.Open();
            cmd = new MySqlCommand("", conn);

            string sql = "SELECT uid FROM user_info";

            cmd.CommandText = sql;
            reader          = cmd.ExecuteReader();

            while (reader.Read())
            {
                string uid = reader["uid"].ToString();
                if (uid == tb_userID.Text)
                {
                    state = true;
                }
            }
            if (state == true)
            {
                SelectUpdateForm dlgUpdate = new SelectUpdateForm(this);
                dlgUpdate.ShowDialog();

                if (dlgUpdate.DialogResult == DialogResult.OK)
                {
                    conn = new MySqlConnection(strConn);
                    conn.Open();
                    cmd = new MySqlCommand("", conn);

                    sql             = "UPDATE user_info SET uid='" + dlgUpdate.tb_userID.Text;
                    sql            += "', upw='" + dlgUpdate.tb_PwChange.Text + "', uname='" + dlgUpdate.tb_Uname.Text;
                    sql            += "', ubirth='" + dlgUpdate.combo_birth1.Text + "." + dlgUpdate.combo_birth2.Text + "." + dlgUpdate.combo_birth3.Text;
                    sql            += "', ugender='" + dlgUpdate.combo_Gender.Text + "', uadress='" + dlgUpdate.tb_Adress.Text;
                    sql            += "', uphone1='" + dlgUpdate.tb_Phone1.Text + "', uphone2='" + dlgUpdate.tb_Phone2.Text + "', uphone3='" + dlgUpdate.tb_Phone3.Text;
                    sql            += "' WHERE uid='" + tb_userID.Text + "'";
                    cmd.CommandText = sql;
                    cmd.ExecuteNonQuery();

                    tb_userID.Text = "";
                    MessageBox.Show("회원정보수정이 완료되었습니다.");

                    conn.Close();
                }
                else
                {
                    tb_userID.Text = "";
                }
            }
            else
            {
                MessageBox.Show("아이디를 확인해주세요.");
            }
        }
Ejemplo n.º 2
0
 public ImageProcessing(SelectUpdateForm form)
 {
     InitializeComponent();
     this.selectUpdateForm = form;
 }