Advertisement
Guest User

Untitled

a guest
May 12th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. Dim conn As ADODB.Connection
  2. Dim admin As ADODB.Recordset
  3. Dim adm As String
  4. Private Sub Form_Load()
  5. connserver
  6. End Sub
  7. Private Sub connserver()
  8. Set conn = New ADODB.Connection
  9. conn.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;Database=advising;User=root;Password=12345; OPTION=3"
  10. conn.Open
  11. End Sub
  12. Private Sub Image1_Click()
  13. Checkuser
  14. End Sub
  15. Private Sub Checkuser()
  16. Dim admin As ADODB.Recordset
  17. Dim adm As String
  18. On Error GoTo a
  19. Set admin = New ADODB.Recordset
  20. admin.CursorLocation = adUseServer
  21. adm = "select * from adminrec where UserName = '" & Text1.Text & "' and Password = '" & Text2.Text & "'"
  22. admin.Open adm, conn
  23. MsgBox "Welcome " & admin!AdminName
  24. Unload Me
  25. adminfrm.Show
  26. Exit Sub
  27. a:
  28. MsgBox "Unauthorized Personel!"
  29. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement