i got an error "No data exists for the row/column."
but when i input whose department is admin is successfully log?
but when i input whose department is admin is successfully log?
VB.NET:
[LEFT]
Dim cmd As New OleDbCommand("SELECT username,passw,departments from accounts where username=('" & Trim(tbx_user.Text) & "') AND passw=( '" & Trim(tbx_pas.Text) & "')", cn)
cn.Open()
Dim sdr As OleDbDataReader = cmd.ExecuteReader()
If (sdr.Read = True And sdr.Item("department") = "admin") Then
MessageBox.Show("Access Granted Administrative Account")
Administrator.Show()
tbx_user.Text = ""
tbx_pas.Text = ""
tbx_user.Focus()
Me.Hide()
ElseIf (sdr.Read = True And sdr.Item("department") = "faculty") Then
MessageBox.Show("Access Granted Faculty Account")
FacStu.Show()
tbx_user.Text = ""
tbx_pas.Text = ""
tbx_user.Focus()
Me.Hide()
ElseIf (sdr.Read = True And sdr.Item("department") = "student") Then
MessageBox.Show("Access Granted Student Account")
FacStu.Show()
tbx_user.Text = ""
tbx_pas.Text = ""
tbx_user.Focus()
Me.Hide()
Else
MessageBox.Show("Access Denied ")
tbx_user.Text = ""
tbx_pas.Text = ""
tbx_user.Focus()
End If
cn.Close()
[FONT=Consolas]
[/FONT][/LEFT]