Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form clients = new clients();

            clients.Show();
            this.Close();
        }
Esempio n. 2
0
        private void add_Click(object sender, EventArgs e)
        {
            try
            {
                if (type)
                {
                    string querry = "INSERT INTO Клиенты (first_name, last_name, middle_name, birth_date, sex, phone, email, address) " +
                                    "VALUES ('" + first_name.Text.ToString() + "','" + last_name.Text.ToString() + "','" + middle_name.Text.ToString() + "','" + birth_date.Text.ToString() + "','" + sex.Text.ToString() + "','" + phone.Text.ToString() + "','" + email.Text.ToString() + "','" + address.Text.ToString() + "')";
                    OleDbCommand command = new OleDbCommand(querry, myConnection);
                    command.ExecuteNonQuery();

                    myConnection.Close();
                    Form clients = new clients();
                    clients.Show();
                    this.Close();
                }
                else
                {
                    string querry = "UPDATE Клиенты SET first_name = '" + first_name.Text.ToString() + "', last_name = '" + last_name.Text.ToString() + "', middle_name = '" + middle_name.Text.ToString() + "', birth_date = '" + Convert.ToDateTime(birth_date.Text) + "', sex = '" + sex.Text + "', phone = '" + phone.Text.ToString() + "', email = '" + email.Text.ToString() + "', address = '" + address.Text.ToString() + "' WHERE id = " + data[0];

                    OleDbCommand command = new OleDbCommand(querry, myConnection);
                    command.ExecuteNonQuery();

                    updateAll();
                    myConnection.Close();
                    Form clients = new clients();
                    clients.Show();
                    this.Close();
                }
            }
            catch
            {
                MessageBox.Show("Операция недоступна, введены некорректные данные");
            }
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string querry = "INSERT INTO Клиенты (first_name, last_name, middle_name, birth_date, phone, email) " +
                            "VALUES ('" + first_name.Text.ToString() + "','" + last_name.Text.ToString() + "','" + middle_name.Text.ToString() + "','" + birth_date.Text.ToString() + "','" + phone.Text.ToString() + "','" + email.Text.ToString() + "')";
            OleDbCommand command = new OleDbCommand(querry, myConnection);

            command.ExecuteNonQuery();

            myConnection.Close();
            Form clients = new clients();

            clients.Show();
            this.Close();
        }