private void ButtonLogin_Click(object sender, EventArgs e) { String loginUser = loginField.Text; String passUser = passField.Text; DB db = new DB(); DataTable table = new DataTable(); MySqlDataAdapter adapter = new MySqlDataAdapter(); MySqlCommand command = new MySqlCommand("SELECT * FROM `Users` WHERE `login` = @uL AND `password` = @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) { this.Hide(); AddProduct mainForm = new AddProduct(); mainForm.Show(); } else { MessageBox.Show("NO"); } }
private void button4_Click(object sender, EventArgs e) { this.Hide(); AddProduct product = new AddProduct(); product.Show(); }