** Here's my codes:
Public Class frmLogin
Dim sqlcode As String
Dim connstring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Jim Clinton Amarga\Desktop\Class Records\Class Records\bin\Debug\dbClassRecords.accdb"
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
If cmbLoginType.Text = "Administrator" Then
Dim sqlLoginCode As String = "select * from tblusers where User_username = '" & txtUsername.Text & "' AND User_password = '" & txtPass.Text & "' AND User_usertype = '" & "Administrator" & "' "
Dim loginCommand As New OleDb.OleDbCommand(sqlLoginCode)
loginCommand.Connection = New OleDb.OleDbConnection(connstring)
loginCommand.Connection.Open()
loginCommand.ExecuteNonQuery()
Dim da As New OleDb.OleDbDataAdapter(loginCommand)
Dim ds As New DataSet
da.Fill(ds, "tblusers")
MessageBox.Show("Welcome Admin")
frmAdmin.Show()
Me.Hide()
ElseIf cmbLoginType.Text = "Teacher" Then
Dim sqlLoginCode As String = "select * from tblusers where User_username = '" & txtUsername.Text & "' AND User_password = '" & txtPass.Text & "' AND User_usertype = '" & "Teacher" & "' "
Dim loginCommand As New OleDb.OleDbCommand(sqlLoginCode)
loginCommand.Connection = New OleDb.OleDbConnection(connstring)
loginCommand.Connection.Open()
loginCommand.ExecuteNonQuery()
Dim da As New OleDb.OleDbDataAdapter(loginCommand)
Dim ds As New DataSet
da.Fill(ds, "tblusers")
MessageBox.Show("Welcome Teacher")
frmTeacherForm.Show()
Me.Hide()
Else
MessageBox.Show("Login Failed!!")
txtUsername.Clear()
txtPass.Clear()
txtUsername.Focus()
End If
End Sub
DATABASE ACCESS: tblusers
User_Id | PK
User_fname | Short Text
User_lname |Short Text
User_username |Short Text
User_password |Short Text
User_usertype |Short Text
When I Selected "Administrator" from the combobox it logged in directly without input the Username and password. please help
**