Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Data.OleDb
- Public Class AdminLogin
- Inherits System.Windows.Forms.Form
- Dim mypath = Application.StartupPath & "\NSDAPS.mdb"
- Dim connection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\NSDAPS.mdb;")
- Dim cmd As OleDbCommand
- Private Sub AdminLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim sql = "SELECT Username,Password FROM Admin_Account WHERE Username = '" & TextBox1.Text & "' AND Password = '" & TextBox2.Text & "'"
- cmd = New OleDbCommand(sql, connection)
- connection.Open()
- Dim dr As OleDbDataReader = cmd.ExecuteReader
- Try
- connection.Open()
- Catch ex As InvalidOperationException
- End Try
- Try
- If dr.Read = False Then
- MsgBox("Login Failed", MsgBoxStyle.Critical, "ADMIN")
- TextBox1.Text = ""
- TextBox2.Text = ""
- Else
- MsgBox("Login Successful", MsgBoxStyle.Information, "ADMIN")
- AdminMenu.Show()
- Me.Hide()
- End If
- Catch ex As Exception
- End Try
- If connection.State <> ConnectionState.Closed Then
- connection.Close()
- End If
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- End
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement