Guest User

Untitled

a guest
Nov 19th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
  2. Dim a As New SqlCommand("select * from log_in where username = '" & UsernameTextBox.Text & "' and password = '" & PasswordTextBox.Text & "'", Module1.koneksi)
  3. Dim dr As SqlDataReader = a.ExecuteReader
  4. dr.Read()
  5. If dr.HasRows = True Then
  6. If dr.Item(2) = 2 Then
  7. MainMenu.Button1.Visible = False
  8. MainMenu.Button2.Visible = False
  9. MainMenu.Show()
  10. Me.Close()
  11. ElseIf dr.Item(2) = 1 Then
  12. MainMenu.Button3.Visible = False
  13. MainMenu.Show()
  14. Me.Close()
  15. Else
  16. MainMenu.Show()
  17. Me.Close()
  18. End If
  19. Else
  20. MsgBox("username dan password tidak terdaftar")
  21. End If
  22. End Sub
  23.  
  24. Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
  25. Me.Close()
  26. End Sub
  27.  
  28. Private Sub LoginForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  29. Try
  30. Module1.koneksi.Close()
  31. Catch ex As Exception
  32. MsgBox("database setting error")
  33. Module1.koneksi.Close()
  34. DBset.Show()
  35. Me.Close()
  36. End Try
  37. End Sub
Add Comment
Please, Sign In to add comment