Saturday, August 13, 2011

Login code's

'Declaration
Dim rs as New ADODB.recordset
Dim conn as New ADODB.connection
Dim sql as String




Private Sub Form_load()


sql = "select * from Login1"
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\BRWSA.mdb;Jet OLEDB:Database Password=Admin;"
rs.Open sql, conn, adOpenStatic, adLockOptimistic
End sub


Private sub cmdLogin_click()
If Text1.Text = "" Then
MsgBox "Plz.. Enter User Name", vbCritical, "Enter UserName"
ElseIf Text2.Text = "" Then
MsgBox "Plz,.. Enter Password", vbCritical, "Enter Password"
Else
rs.Find "Username= '" & Text1.Text & "'"
While rs.EOF
rs.MoveFirst
Wend
If rs.Fields!UserName = Text1.Text Then
 If rs.Fields!Password = Text2.Text Then

 conn.Close
Form1.Show
Unload Me
 Else
 MsgBox "Invalid Password!...", vbInformation, "login"
 Me.Show
    End If
    Else
       MsgBox "Invalid UserName", vbInformation, "login"
    Me.Show
    End If

End If
End sub




<[@]> Red Fang <[@]>

No comments:

Post a Comment