Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie - customvalidator
Message
From
16/02/2006 10:45:40
Teddy Win
Bytel Information Technology
Jakarta, Indonesia
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Newbie - customvalidator
Miscellaneous
Thread ID:
01096747
Message ID:
01096747
Views:
65
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
Next
Reply
Map
View

Click here to load this message in the networking platform