Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Newbie - customvalidator
Message
De
16/02/2006 11:51:33
 
 
À
16/02/2006 10:45:40
Teddy Win
Bytel Information Technology
Jakarta, Indonésie
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01096747
Message ID:
01096776
Vues:
19
Do it the easy way with the Login and Membership controls in ASP.Net 2.0.


>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
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform