Salut tt le monde,
j'ai une table qui s'appelle client en sql server2000qui contient 2 champs "login" et "password"
ds ma webForm j cherche un login si'il existe ds la table client ou pas mais le probleme Mr c'est que même si le login existe le resultat est tjrs "ce login n'existe pas"
voici le code que j'ai utilisé:
Private Function Authentifier(ByVal strUtilisateur As String) As Boolean
Dim ok As Boolean
Dim cnx As New sds.SqlConnection
Dim cmd As New sds.SqlCommand
Dim rd As sds.SqlDataReader
ok = False
cnx.ConnectionString = "workstation id=ELOI;packet size=4096;integrated security=SSPI;initial catalog=fret;persist security info=False"
cmd.CommandText = "select * from client where login='" + strUtilisateur + "'"
cmd.CommandType = CommandType.Text
cmd.Connection = cnx
cnx.Open()
rd = cmd.ExecuteReader
While rd.Read
If (rd.Item("login") = strUtilisateur) Then
ok = True
Else
ok = False
End If
End While
rd.Close()
Return ok
End Function
j'appelle cette fonction ds le click d'un bouton
if (authentifier(utilisateur.text)) then
response.redirect("webForm2")
else
Label.text="ce code n'existe pas"
Merci pour votre aide