Form Login
Form login ini digunakan untuk proses log in ke dalam aplikasi latihan kita. Form akan melakukan validasi terhadap inputan user yang akan log in ke dalam aplikasi.
design
terdiri dari
coding
Private Sub cmdCancel_Click()
End
End Sub
Private Sub cmdOK_Click()
If txtUser.Text <> "" And txtPasswd.Text <> "" Then
Set rsLogin = New ADODB.Recordset
rsLogin.LockType = adLockOptimistic
rsLogin.CursorType = adOpenDynamic
rsLogin.Open "SELECT * FROM Login WHERE user_name = '" & txtUser.Text & "' AND password = '" & txtPasswd.Text & "'", conn, , , adCmdText
If Not rsLogin.EOF Then
MsgBox ("Login Berhasil")
frmData.Show
frmLogin.Visible = False
Else
MsgBox "Username dan Password Salah", vbCritical
Exit Sub
End If
End If
End Sub
Private Sub Form_Load()
koneksi_db
End Sub
design
terdiri dari
- 1 buah form
- 2 buah textbox
- 2 buah label
- 2 buah command button
coding
Private Sub cmdCancel_Click()
End
End Sub
Private Sub cmdOK_Click()
If txtUser.Text <> "" And txtPasswd.Text <> "" Then
Set rsLogin = New ADODB.Recordset
rsLogin.LockType = adLockOptimistic
rsLogin.CursorType = adOpenDynamic
rsLogin.Open "SELECT * FROM Login WHERE user_name = '" & txtUser.Text & "' AND password = '" & txtPasswd.Text & "'", conn, , , adCmdText
If Not rsLogin.EOF Then
MsgBox ("Login Berhasil")
frmData.Show
frmLogin.Visible = False
Else
MsgBox "Username dan Password Salah", vbCritical
Exit Sub
End If
End If
End Sub
Private Sub Form_Load()
koneksi_db
End Sub
Comments
Post a Comment