Exemple #1
0
        private void buttonNewRegist_Click(object sender, EventArgs e)
        {
            Registr form = new Registr();

            string name     = textboxNewName.Text,
                   surname  = textboxNewSurname.Text,
                   position = textboxNewPosition.Text,
                   phone    = textboxNewPhone.Text,
                   login    = textboxNewLogin.Text,
                   password = textboxNewPassword.Text;



            // текст запроса

            string query = "INSERT INTO workers (IDPosition, nameWorker, surnameWorker, phoneNuber, login, [password]) " +
                           "VALUES('" + position + "', '" + name + "', '" + surname + "', '" + phone + "', '" + login + "', '" + password + "')";

            // создаем объект OleDbCommand для выполнения запроса к БД MS Access
            OleDbCommand command = new OleDbCommand(query, myConnection);

            // выполняем запрос к MS Access
            if (name == " " || surname == " " || position == " " || phone == " " || login == " " || password == " " ||
                name == "" || surname == "" || position == "" || phone == "" || login == "" || password == "")
            {
                noInput.Text = "Вы заполнили не все поля";
            }
            else
            {
                command.ExecuteNonQuery();
            }

            this.Close();
        }
Exemple #2
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Registr newForm = new Registr();

            newForm.Show();
        }