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 Dannye (name_dan, adres_dan, city_dan, number_dan, contact_dan) values ('{textBox1.Text}','{textBox2.Text}','{textBox3.Text}','{textBox4.Text}','{textBox5.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();
- }
- }
- }
|