示例#1
0
        private void EditDataBtn_Click(object sender, EventArgs e)
        {
            NumberPhoneText.ReadOnly = false;
            EmailTextBox.ReadOnly    = false;
            NicknameText.ReadOnly    = false;

            EditChangeBtn.Show();
        }
示例#2
0
        private void EditChangeBtn_Click(object sender, EventArgs e)
        {
            string connStr = "server=localhost;user=root;database=estateagency;password=root";

            MySqlConnection conn = new MySqlConnection(connStr);

            conn.Open();

            string sql = $"UPDATE profile " +
                         $"SET nickname = '{NicknameText.Text}' " +
                         $"WHERE id_profile = {id_profile.ToString()};";
            MySqlCommand command = new MySqlCommand(sql, conn);

            command.ExecuteScalar();

            sql = $"UPDATE profile " +
                  $"SET email = '{EmailTextBox.Text}' " +
                  $"WHERE id_profile = {id_profile.ToString()};";
            command = new MySqlCommand(sql, conn);

            command.ExecuteScalar();

            sql = $"UPDATE profile " +
                  $"SET phoneNumber = '{NumberPhoneText.Text}' " +
                  $"WHERE id_profile = {id_profile.ToString()};";
            command = new MySqlCommand(sql, conn);

            command.ExecuteScalar();

            conn.Close();

            NumberPhoneText.ReadOnly = true;
            EmailTextBox.ReadOnly    = true;
            NicknameText.ReadOnly    = true;
            EditChangeBtn.Hide();
        }