Авторизация.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Data.OleDb;
  11. namespace Услуги_салона_красоты_Тураев
  12. {
  13. public partial class Авторизация : Form
  14. {
  15. public Авторизация()
  16. {
  17. InitializeComponent();
  18. }
  19. private void button1_Click(object sender, EventArgs e)
  20. {
  21. if (MessageBox.Show("Вы точно хотите выйти?", "Сообщение", MessageBoxButtons.YesNo, MessageBoxIcon.Question)==DialogResult.Yes)
  22. {
  23. Environment.Exit(0);
  24. }
  25. }
  26. private void button2_Click(object sender, EventArgs e)
  27. {
  28. OleDbConnection a = new OleDbConnection(@"Provider = Microsoft.Jet.OLEDB.4.0; Data Source = Login_Parol.mdb");
  29. OleDbDataAdapter b = new OleDbDataAdapter("Select Count(*) From Логин_Пароль where Логин = '" + textBox1.Text + "' and Пароль = '" + textBox2.Text + "'", a);
  30. DataTable c = new DataTable();
  31. b.Fill(c);
  32. if (c.Rows[0][0].ToString() == "1")
  33. {
  34. Hide();
  35. MessageBox.Show("Здравствуйте, " + textBox1.Text, "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
  36. Главное_меню f = new Главное_меню();
  37. f.Show();
  38. }
  39. else
  40. {
  41. MessageBox.Show("Неверный логин или пароль!", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  42. }
  43. }
  44. }
  45. }