Hello friends,
How can i implement the validation in our project, means if validation == true then the next page will open else shows an error message.
please reply.
Thanks.
Hello friends,
How can i implement the validation in our project, means if validation == true then the next page will open else shows an error message.
please reply.
Thanks.
Hi,
You can implement page validations but,
Page.Validate is not the same as Page.IsValid (obviously)
I've never found a reason to call Page.Validate myself (not that there probably aren't some good ones). Here is a contrived example from the help files.
I always do a check of Page.IsValid first thing in my button click events.Sub Page_Load
If Not IsPostBack
' Validate initially to force the asterisks
' to appear before the first roundtrip.
Validate()
End If
End Sub
If Not Page.IsValid Then Return, if (for whatever reason) your client-side javascript didn't prevent the page from posting in the first place then the server validate
events will run.
You use Page.IsValid to make sure that the server validation didn't catch anything.
Thats very much fine my friend but my need is that i have 2 pages and want to valiadate
page1 by user name and password.....if the password is correct only then one should
reach on the next page.
Thanks very much for this information and please suggest me how can i do that?
Hi joe,
Here is the code might help you:
Option Explicit
![]()
Private Sub cmdOK_Click() Dim cn As New ADODB.Connection Dim strCNString As String Dim rs As New ADODB.Recordset Dim Txt As String On Error GoTo ErrHandler 'Connect to database strCNString = "Data Source=" & App.Path & "\db1.mdb" cn.Provider = "Microsoft Jet 4.0 OLE DB Provider" cn.ConnectionString = strCNString cn.Properties("Jet OLEDB:Database Password") = "jason" cn.Open 'Open recordsource With rs .Open "Select * from Users where Username='" & txtUserName.Text & "' and Password='" & txtPassword.Text & "'", cn, adOpenDynamic, adLockOptimistic 'Check username and password If .EOF Then MsgBox "Access Denied...Please enter correct password!", vbOKOnly + vbCritical, "Security Login" txtUserName.Text = "" txtPassword.Text = "" txtUserName.SetFocus cn.Close Else Txt = "" & " " & UCase$(txtUserName.Text) & "" MsgBox "Welcome!!!" & Txt, vbOKOnly + vbExclamation, "Security Login" cn.Close Unload Me frmmain.Show End If End With ExitHere: Exit Sub ErrHandler: MsgBox Err.Number & " " & Err.Description, vbCritical, "Login ..." cn.Close End Sub
ExlGuru
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks