Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class LoginForm
- Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
- Dim connection As New SqlClient.SqlConnection
- Dim command As New SqlClient.SqlCommand
- Dim adaptor As New SqlClient.SqlDataAdapter
- Dim dataset As New DataSet
- connection.ConnectionString = ("Data Source =.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\LMSWARREN.mdf;Integrated Security=True;User Instance=True")
- command.CommandText = "Select * from [USERS] WHERE username = '" & TextBox1.Text & "' and password = '" & TextBox2.Text & "'"
- connection.Open()
- command.Connection = connection
- adaptor.SelectCommand = command
- adaptor.Fill(dataset, " 0 ")
- Dim count = dataset.Tables(0).Rows.Count
- If count > 0 And TextBox1.Text = "ADMIN" And TextBox2.Text = "APASSWORD" Then
- frmAdmin.Show()
- Me.Hide()
- ElseIf count > 0 And TextBox1.Text = "USER" And TextBox2.Text = "UPASSWORD" Then
- frmBookTransacation.Show()
- Me.Hide()
- Else
- MsgBox("Invalide details exiting system, try again...!!!")
- Me.Close()
- End If
- End Sub
- Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
- Me.Close()
- End Sub
- Private Sub LogoPictureBox_Click(sender As System.Object, e As System.EventArgs) Handles LogoPictureBox.Click
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement