Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Dim dbcon As New ADODB.Connection
- Dim rs As New ADODB.Recordset
- Private Sub cmdCancel_Click()
- End
- End Sub
- Private Sub cmdOK_Click()
- If txtUserName.Text = "" Then
- MsgBox "Please enter username"
- Exit Sub
- End If
- If txtPassword.Text = "" Then
- MsgBox "please enter password"
- Exit Sub
- End If
- If rs.State = 1 Then
- rs.Close
- Set rs = Nothing
- End If
- rs.Open "select * from login14yasb where username = '" & Trim(txtUserName.Text) & "' and password = '" & Trim(txtPassword.Text) & "'", dbcon, 1, 2
- If rs.RecordCount > 0 Then
- MsgBox "user credentials are authenticated successfully"
- Else
- MsgBox "Invalid credentials"
- End If
- End Sub
- Private Sub Form_Load()
- dbcon.Open "libdsn", "scott", "tiger"
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- If dbcon.State = 1 Then
- dbcon.Close
- Set dbcon = Nothing
- End If
- End Sub
Add Comment
Please, Sign In to add comment