Advertisement
Guest User

Untitled

a guest
May 15th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. Public Class LoginForm
  2.  
  3.  
  4.  
  5. Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
  6.  
  7. Dim connection As New SqlClient.SqlConnection
  8. Dim command As New SqlClient.SqlCommand
  9. Dim adaptor As New SqlClient.SqlDataAdapter
  10. Dim dataset As New DataSet
  11.  
  12. connection.ConnectionString = ("Data Source =.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\LMSWARREN.mdf;Integrated Security=True;User Instance=True")
  13. command.CommandText = "Select * from [USERS] WHERE username = '" & TextBox1.Text & "' and password = '" & TextBox2.Text & "'"
  14.  
  15. connection.Open()
  16. command.Connection = connection
  17.  
  18. adaptor.SelectCommand = command
  19. adaptor.Fill(dataset, " 0 ")
  20.  
  21. Dim count = dataset.Tables(0).Rows.Count
  22. If count > 0 And TextBox1.Text = "ADMIN" And TextBox2.Text = "APASSWORD" Then
  23. frmAdmin.Show()
  24. Me.Hide()
  25. ElseIf count > 0 And TextBox1.Text = "USER" And TextBox2.Text = "UPASSWORD" Then
  26. frmBookTransacation.Show()
  27. Me.Hide()
  28. Else
  29.  
  30. MsgBox("Invalide details exiting system, try again...!!!")
  31.  
  32. Me.Close()
  33. End If
  34.  
  35. End Sub
  36.  
  37. Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
  38. Me.Close()
  39. End Sub
  40.  
  41. Private Sub LogoPictureBox_Click(sender As System.Object, e As System.EventArgs) Handles LogoPictureBox.Click
  42.  
  43. End Sub
  44. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement