1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| private void Valider_Click(object sender, EventArgs e)
{
{
con.Open();
com = new OleDbCommand("SELECT * FROM utilisateur", con);
OleDbDataReader dr;
dr = com.ExecuteReader();
dr.Read();
do
{
if (txtBox_username.Text.Trim().ToLower() == dr["login"].ToString().Trim()
&& txtBox_password.Text.Trim() == dr["mdp"].ToString().Trim())
{
MessageBox.Show("Bienvenue !!" + txtBox_username);
Form1 f1 = new Form1();
f1.Visible = true;
this.Visible = false;
}
else
{
MessageBox.Show("login ou mot de passe incorrecte", "ERREUR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
}
} while (dr.Read());
dr.Close();
con.Close();
}
} |
Partager