Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text == string.Empty)
                {
                    MessageBox.Show("Введите пароль!", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string Update = "exec dbo.UpdateUser '" + textBox2.Text.Trim() + "','" + textBox3.Text.Trim() + "','" + textBox4.Text.Trim() + "','" + textBox1.Text.Trim() + "'," + comboBox1.SelectedValue.ToString() + "," + selectID;
                    DbConnection.DBConnect(Update);

                    MessageBox.Show("Пользователь изменён!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    AllUserForm allUserForm = this.Owner as AllUserForm;
                    allUserForm.Refresh();

                    selectID  = 0;
                    role      = string.Empty;
                    Fristname = string.Empty;
                    Surname   = string.Empty;

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string FillUser = "******" + textBox2.Text.Trim() + "','" + textBox3.Text.Trim() + "','" + textBox4.Text.Trim() + "','" + textBox1.Text.Trim() + "','" + comboBox1.SelectedValue.ToString() + "'";
                DbConnection.DBConnect(FillUser);
                MessageBox.Show("Пользователь добавлен!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);

                AllUserForm allUserForm = this.Owner as AllUserForm;
                allUserForm.Refresh();

                this.Close();
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }