12345678910111213141516171819202122232425262728293031323334353637383940 |
- 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 Kurs09
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- pass.PasswordChar = '*';
- }
- private void buttonLogin_Click(object sender, EventArgs e)
- {
- string loginUser = login.Text;
- String passUser = pass.Text;
- DB db = new DB();
- DataTable table = new DataTable();
- MySqlDataAdapter adapter = new MySqlDataAdapter();
- MySqlCommand command = new MySqlCommand("SELECT * FROM users WHERE login = @uL AND pass = @uP", db.GetConnection());
- command.Parameters.Add("@uL", MySqlDbType.VarChar).Value = loginUser;
- command.Parameters.Add("@uP", MySqlDbType.VarChar).Value = passUser;
- adapter.SelectCommand = command;
- adapter.Fill(table);
- if (table.Rows.Count > 0)
- MessageBox.Show("Yes");
- else
- MessageBox.Show("No");
- }
- }
- }
|