Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim mypath = Application.StartupPath & "\password.mdb"
- Dim Password = ""
- Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Harold\Desktop\softengfinal\db1.mdb")
- Dim cmd As OleDb.OleDbCommand
- End Sub
- Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
- Dim sql = "SELECT Username,Password FROM Password WHERE Username = '" & TextBox1.Text & "' AND Password = '" & TextBox2.Text & "'"
- cmd = New OleDb.OleDbCommand(sql, conn)
- Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader
- Try
- conn.Open()
- Catch ex As InvalidOperationException
- MsgBox(ex.Message)
- End Try
- Try
- If dr.Read = False Then
- MessageBox.Show("Authentication Failed...")
- Else
- MessageBox.Show("Login Successful...")
- End If
- Catch ex As Exception
- MsgBox(ex.Message)
- End Try
- If conn.State <> ConnectionState.Closed Then
- conn.Close()
- End If
- Dim form As New Form2
- mMenu.Show()
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement