123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- namespace project
- {
- public partial class DannyeAdd : Form
- {
- DataBase dataBase = new DataBase();
- public DannyeAdd()
- {
- InitializeComponent();
- }
- private void button4_Click(object sender, EventArgs e)
- {
- dataBase.openConnection();
- var addQuery = $"insert into Student (name, surname, patronymic, number, group_type, codeCard) values ('{textBox1.Text}','{textBox2.Text}','{textBox3.Text}','{textBox4.Text}','{textBox5.Text}','{textBox6.Text}')";
- var command = new SqlCommand(addQuery, dataBase.GetConnection());
- command.ExecuteNonQuery();
- MessageBox.Show("Запись успешно добавлена в таблицу");
- dataBase.closeConnection();
- this.Hide();
- Main MAIN = new Main();
- MAIN.Show();
- }
- private void DannyeAdd_FormClosed(object sender, FormClosedEventArgs e)
- {
- Application.Exit();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- this.Hide();
- Main main = new Main();
- main.Show();
- }
- }
- }
|