using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
public partial class Connexion : Form
private string maRequete;
private MySqlDataReader monReader;
private MySqlConnection connection;
textBox2.KeyUp += new KeyEventHandler(mdp_enter);
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
Form Inscription = new Inscription();
Inscription.ShowDialog();
private void Connexion_Load(object sender, EventArgs e)
string ConnectionString = "Server=localhost;DATABASE=gsb;UID=root;Password=";
connection = new MySqlConnection(ConnectionString);
private void button1_Click(object sender, EventArgs e)
maRequete = "SELECT Uti_id FROM utilisateur WHERE Uti_log=\'" + textBox1.Text + "\' and Uti_motDePasse=\'"+textBox2.Text + "\'";
MySqlCommand maCommande = connection.CreateCommand();
maCommande.CommandText = maRequete;
monReader = maCommande.ExecuteReader();
GoPlanning(Convert.ToInt32(monReader.GetValue(0)));
Recherche_Formation Recherche = new Recherche_Formation(Convert.ToInt32(monReader.GetValue(0)));
MessageBox.Show("Identifiant et/ou mot de passe incorrects", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
private void GoPlanning(int id)
var form2 = new Planning(id);
form2.Closed += (s, args) => this.Close();
private void mdp_enter(object sender, KeyEventArgs e)
if(e.KeyCode == Keys.Enter)
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)