private void button1_Click(object sender, System.EventArgs e)
 {
     string login = loginBX.Text;
     string password = passBX.Text;
     string MyConString = "SERVER=localhost;" +
         "DATABASE=baza;" +
         "UID=root;";
     MySqlConnection connection = new MySqlConnection(MyConString);
     string command = "select ID, posada from pracownicy where login='******' and haslo='" + password + "';";
     MySqlDataAdapter da = new MySqlDataAdapter(command, connection);
     DataTable dt = new DataTable();
     da.Fill(dt);
     if (dt.Rows.Count > 0)
     {
         if (Convert.ToInt32(dt.Rows[0][1]) == 1)
         {
             Serw serw = new Serw(login);
             serw.Show();
             this.Hide();
         }
         else
         {
             Admin admin = new Admin();
             admin.Show();
             this.Hide();
         }
     }
 }
Пример #2
0
 private void button1_Click(object sender, System.EventArgs e)
 {
     string login = loginBX.Text;
     string password = passBX.Text;
     string MyConString = "SERVER=localhost;" +
         "DATABASE=baza;" +
         "UID=root;";
     MySqlConnection connection = new MySqlConnection(MyConString);
     string command = "select ID, posada from pracownicy where login='******' and haslo='" + password + "';";
     MySqlDataAdapter da = new MySqlDataAdapter(command, connection);
     DataTable dt = new DataTable();
     da.Fill(dt);
     if (dt.Rows.Count > 0)
     {
         if (Convert.ToInt32(dt.Rows[0][1]) == 1)
         {
             Serw serw = new Serw(login);                   
             serw.Show();
             this.Hide();
         }
         else
         {
             Admin admin = new Admin();
             admin.Show();
             this.Hide();
         }
     }
 }