how i put it like i am a student so i choose student and key in username n password, if choose worng like i click lectuere but i not, so cant is worng cant login
Private Sub cbinfo_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbinfo.SelectedIndexChanged
Dim conn As New System.Data.OleDb.OleDbConnection()
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\temp\Database1.accdb"
Try
Dim sqlcmd As String = "SELECT Count(*) FROM tbl_datain WHERE Personl ='" & cbinfo.Items(cbinfo.SelectedIndex) & "' " & _
"And UserID ='" & txtname.Text & "' And PassWord ='" & txtpass.Text & "'"
Dim sqlCom As New System.Data.OleDb.OleDbCommand(sqlcmd)
sqlCom.Connection = conn
conn.Open()
Dim Result As Integer = sqlCom.ExecuteScalar
sqlCom.Dispose()
conn.Close()
If Result > 0 Then
MessageBox.Show("Present")
Else
MessageBox.Show("Wrong Input")
End If
Catch ex As Exception
End Try
Catch ex As Exception
End Try