Dim cmd As OleDbCommand = New OleDbCommand("SELECT username,password FROM tblUsers where username=? and password=?", conn)
Dim usernameParam As New OleDbParameter("@username", Me.txtUsername.Text)
Dim passwordParam As New OleDbParameter("@password", Me.txtPass.Text)
cmd.Parameters.Add(usernameParam)
cmd.Parameters.Add(passwordParam)
Try
connectDatabase()
Dim read As OleDbDataReader = cmd.ExecuteReader()
If read.HasRows Then
read.Read()
If txtUsername.Text = read.Item("username").ToString And txtPass.Text = read.Item("password").ToString Then
MsgBox("Login successful")
frmMenuAdmin.Show()
Me.Close()
Else
MsgBox("Login unsuccessful, username and passwords are case sensitive")
End If
Else
MsgBox("Login unsuccessful")
End If
read.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
DisconnectDatabase()
End Try
Dim read As OleDbDataReader = cmd.ExecuteReader()
< < < error here saying No value given for the one or required parameters
pls help