using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace yrok2 { public partial class Authorization : Form { Class1 database = new Class1(); public Authorization() { InitializeComponent(); StartPosition = FormStartPosition.CenterScreen; } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { string usern = textBox1.Text; string pass = textBox2.Text; SqlDataAdapter adapter = new SqlDataAdapter(); DataTable table = new DataTable(); string querystring = $"SELECT Login, Password FROM LoginPassword WHERE Login = '{usern}' and Password = '{pass}'"; SqlCommand command = new SqlCommand(querystring, database.GetConnection()); adapter.SelectCommand = command; adapter.Fill(table); if (table.Rows.Count == 1) { MessageBox.Show("Успешно!"); Form2 frm = new Form2(); this.Hide(); frm.Show(); } else MessageBox.Show("Неверные данные"); } private void panel2_Paint(object sender, PaintEventArgs e) { } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Form3 frm = new Form3(); this.Hide(); frm.Show(); } } }