I really don't have a clue on how to even start this, making a login form. So i've been searching around trying to find others doing the same thing but i haven't found much and what i have found they are using different databases. But here's what i have so far.
Right now im getting an error at conn.Open()
"The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine."
Honestly i really don't know if im even going in the right direction. So i need help to find out if i am going in the right direction and fix the bugs i'm getting.
Thanks in advance!
Public Class LoginForm1
Dim cmd As OleDb.OleDbCommand
Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Pubs.mdb")
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Dim sql = "SELECT username,emp_id FROM employee WHERE username = '" & UsernameTextBox.Text & "' AND emp_id = '" & PasswordTextBox.Text & "'"
cmd = New OleDb.OleDbCommand(sql, conn)
conn.Open()
Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader
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 Form1
form.Show()
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 EmployeeBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EmployeeBindingNavigatorSaveItem.Click
Me.Validate()
Me.EmployeeBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.PubsLoginDataSet)
End Sub
Private Sub LoginForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'PubsLoginDataSet.employee' table. You can move, or remove it, as needed.
Me.EmployeeTableAdapter.Fill(Me.PubsLoginDataSet.employee)
End Sub
End Class