1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- 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 Perevozki
- {
- public partial class Auth : Form
- {
- public Auth()
- {
- InitializeComponent();
- StartPosition = FormStartPosition.CenterScreen;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- DB dataBase = new DB();
- var log = textBox1.Text;
- var pass = textBox2.Text;
- SqlDataAdapter adapter = new SqlDataAdapter();
- DataTable table = new DataTable();
- string querystring = $"select Login, Password from Polzovateli where Login='{log}' and Password='{pass}'";
- SqlCommand command = new SqlCommand(querystring, dataBase.GetConnection());
- adapter.SelectCommand = command;
- adapter.Fill(table);
- if (table.Rows.Count > 0)
- {
- MessageBox.Show("Вы успешно вошли!");
- Menu f2 = new Menu();
- f2.ShowDialog();
-
- }
- else
- {
- MessageBox.Show("Неверный логин или пароль, повторите попытку");
- }
- }
- }
- }
|