-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSignUp.cs
60 lines (51 loc) · 1.98 KB
/
SignUp.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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;
namespace Шифровщик
{
public partial class SignUp : Form
{
public SignUp()
{
InitializeComponent();
}
private void label3_Click(object sender, EventArgs e)
{
}
private void SignUpButton_Click(object sender, EventArgs e)
{
string loginUser = LoginBox.Text;
string passUser = null;
if(PassBox.Text == null || PassBox2.Text == null)
{
MessageBox.Show("Заполните все поля паролей");
}
else
{
if (PassBox.Text == PassBox2.Text)
passUser = PassBox.Text;
else
MessageBox.Show("Пароли не верны");
}
DB db = new DB();
DataTable table = new DataTable();
MySqlDataAdapter adapter = new MySqlDataAdapter();
MySqlCommand command = new MySqlCommand("INSERT INTO users (login, pass) VALUES (@UL, @UP);", db.getConnection());//@UL, @UP - заглушки для безопасности
command.Parameters.Add("@UL", MySqlDbType.VarChar).Value = loginUser;//Присвоение значения заглушке
command.Parameters.Add("@UP", MySqlDbType.VarChar).Value = passUser;
adapter.SelectCommand = command;//Указываем какую команду выполнять
adapter.Fill(table);//Заполн яем объект table полученными данными loginUser и passUser
MessageBox.Show("теперь вы можете войти");
}
private void LoginBox_TextChanged(object sender, EventArgs e)
{
}
}
}