45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
|
|
using MySql.Data.MySqlClient;
|
|||
|
|
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 static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|||
|
|
|
|||
|
|
namespace KursovayaDvornikovAM
|
|||
|
|
{
|
|||
|
|
public partial class AddUser : Form
|
|||
|
|
{
|
|||
|
|
public AddUser()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void Add_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
string connect = "server=cfif31.ru;user=ISPr24-37_DvornikovAM;database=ISPr24-37_DvornikovAM_Kursovaya;password=ISPr24-37_DvornikovAM";
|
|||
|
|
|
|||
|
|
MySqlConnection connection = new MySqlConnection(connect);
|
|||
|
|
{
|
|||
|
|
connection.Open();
|
|||
|
|
|
|||
|
|
|
|||
|
|
var Password = textBox1.Text;
|
|||
|
|
var Name = textBox2.Text;
|
|||
|
|
var Surname = textBox3.Text;
|
|||
|
|
|
|||
|
|
var add = $"INSERT INTO Polzovatel (Password, Name, Surname) VALUES ('{Password}', '{Name}', {Surname})";
|
|||
|
|
var command = new MySqlCommand(add, connection);
|
|||
|
|
command.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
|
|||
|
|
connection.Close();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|