Bonjour,
Je développe actuellement une application sous Access.
Je souhaiterai créer une fenêtre d'authentification, où si le login et le mot de passe sont correctes la fenetre suivante s'affiche.
Voila le code de ma fonction authentifier :
Le problème étant que sa me renvoie toujours "false" alors que le login et le MDP saisi sont bons.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 private bool authentifier(string strUtilisateur, string strMotDePasse) { bool bOk = false; OleDbConnection oConnexion = new OleDbConnection(Properties.Settings.Default.VideoSurveillanceConnectionString); oConnexion.Open(); OleDbCommand oCommand = new OleDbCommand("select * from user where Loginuser ='" + strUtilisateur + "'", oConnexion); try { OleDbDataReader drUtilisateur = oCommand.ExecuteReader(); while (drUtilisateur.Read()) { if (drUtilisateur["MDPUser"].ToString() == strMotDePasse) { bOk = true; break; } } } catch { bOk = false; } oConnexion.Close(); return bOk; }
Pouvez vous m'aider ?
Merci
Partager