private void button2_Click(object sender, EventArgs e) { Espace_Agent F16 = new Espace_Agent(); F16.Show(); FormsApplication.AddForm(F16); this.Close(); }
private void button1_Click(object sender, EventArgs e) { string server = "localhost"; string database = "GestionnaireSTL"; string user = "******"; string connectionString = "database=" + database + "; server= " + server + ";user ="******"select * from compte where login = @login and mot_de_passe = @password"; MySqlCommand cmd = new MySqlCommand(query, cnx); cmd.Parameters.AddWithValue("@login", login); cmd.Parameters.AddWithValue("@password", password); MySqlDataReader rd = cmd.ExecuteReader(); if (rd != null) { if (rd.Read()) { MessageBox.Show("Bienvenue " + rd[2] + " " + rd[3] + "!"); if ((string)rd[6] == "Admin") { cnx.Close(); Espace_Admin F3 = new Espace_Admin(); F3.Show(); FormsApplication.AddForm(F3); this.Close(); } else if ((string)rd[6] == "Agent") { cnx.Close(); Espace_Agent F16 = new Espace_Agent(); F16.Show(); FormsApplication.AddForm(F16); this.Close(); } } else { MessageBox.Show("Compte non existant!"); } } }