Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Newbie - customvalidator
Message
De
16/02/2006 10:45:40
Teddy Win
Bytel Information Technology
Jakarta, Indonésie
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Newbie - customvalidator
Divers
Thread ID:
01096747
Message ID:
01096747
Vues:
64
Dear All,
I am very new to ASP.NET, I am trying to create my 1st login page with customvalidator.. but it does not work.. I meant customvalidator not showing the message when user failed to login..

I need advise..

TIA & Regards
Teddy

Private Sub BtnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLogin.Click

CustomValidator1.Validate()

End Sub

Private Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
' Define ADO.NET Objects
Dim SQLSelect As String = "SELECT USERID, PASSWORD FROM USERS WHERE USERID = '" & txtUserID.Text & "' AND PASSWORD = '" & txtPassword.Text & "'"
Dim Cmd As New OleDbCommand(SQLSelect, Conn)
Try
Conn.Open()

Reader = Cmd.ExecuteReader()
Reader.Read()
If txtUserID.Text = Reader("UserId") And txtPassword.Text = Reader("Password") Then

'CustomValidator1.ErrorMessage = "Succeed!"



Else
CustomValidator1.ErrorMessage = "Invalid Credential"
End If
Reader.Close()
Catch err As Exception
CustomValidator1.ErrorMessage = err.Message
Finally
If Not Conn Is Nothing Then
Conn.Close()
End If
End Try
End Sub
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform