private void button5_Click(object sender, EventArgs e)
        {
            info Iinfo = new info();

            Iinfo.Show();
            this.Hide();
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                using (SqlConnection cn = getConnection())
                {
                    SqlCommand command = new SqlCommand(" UPDATE info SET [user_name] = @user_name, [surname] =  @surname, [birthday] = @birthday, [phone] = @phone, [email] = @email  WHERE [users_id]= @id", cn);
                    command.Parameters.Add("@user_name", SqlDbType.VarChar).Value = name_user.Text;
                    command.Parameters.Add("@surname", SqlDbType.VarChar).Value   = surname_user.Text;
                    command.Parameters.Add("@birthday", SqlDbType.Date).Value     = dateTimePicker1.Value;
                    command.Parameters.Add("@phone", SqlDbType.VarChar).Value     = phone.Text;;
                    command.Parameters.Add("@email", SqlDbType.VarChar).Value     = email.Text;
                    command.Parameters.Add("@id", SqlDbType.Int).Value            = Convert.ToInt32(id.get_idUser());

                    cn.Open();

                    if (command.ExecuteNonQuery() == 1)
                    {
                        MessageBox.Show("Все данные успешно обновлены!!!");
                        this.Hide();
                        Iinfo.Show();
                    }
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.ToString());
            }
        }