1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
Dim strConnec As String = "*******"
Dim Connexion1 As SqlConnection = New SqlConnection(strConnec)
Dim Command1 As SqlCommand = Connexion1.CreateCommand()
Command1.CommandText = "select login, Passe from Clients"
Connexion1.Open()
Dim Reader1 As SqlDataReader = Command1.ExecuteReader()
While Reader1.Read
Dim log As String = Reader1.GetString(0)
Dim pas As String = Reader1.GetString(1)
If UsernameTextBox.Text = log And PasswordTextBox.Text = pas Then
MessageBox.Show("C bon", "yes", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Bienvenue.ShowDialog()
Else
MessageBox.Show("Votre login ou votre mot de passe est incorrect, " & UsernameTextBox.Text & " , " & log & " , " & PasswordTextBox.Text & " , " & pas, "Erreur d'authentification", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
End While
Reader1.Close()
Connexion1.Close() |
Partager