12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace project
- {
- public partial class Vhod : Form
- {
- public Vhod()
- {
- InitializeComponent();
- }
- private void Vhod_FormClosed(object sender, FormClosedEventArgs e)
- {
- Application.Exit();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- if (polelogin.Text.Replace(" ", "") == "") MessageBox.Show("Поле логин не может быть пустым");
- else if (polepassword.Text.Replace(" ", "") == "") MessageBox.Show("Поле пароль не может быть пустым");
- else
- {
- SqlConnection sqlconn = new SqlConnection(@"Data Source=ngknn.ru;Initial Catalog=Project_GorodskoiSpravochnik;Persist Security Info=True;User ID=31П;Password=12357");
- string query = "Select *from Employee where login = '" + polelogin.Text.Trim() + "' and password = '" + polepassword.Text.Trim() + "'";
- SqlDataAdapter sda = new SqlDataAdapter(query, sqlconn);
- DataTable dtbl = new DataTable();
- sda.Fill(dtbl);
- if (dtbl.Rows.Count == 1)
- {
- Login.login = polelogin.Text.Trim();
- this.Hide();
- Main Main = new Main();
- Main.ShowDialog();
- }
- else
- {
- MessageBox.Show("Неверный логин и/или пароль");
- }
- }
- }
- }
- }
|