PLease help me. I'm doing a login form with ms access but this line of code having problem "Dim dr As OleDbDataReader = cmd.ExecuteReader"
Below is the source code
Imports System.Data.OleDb
Public Class Form1
Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\leong\documents\visual studio 2010\Projects\WindowsApplication4\WindowsApplication4\coursework.mdb")
Dim cmd As OleDbCommand
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sql = "SELECT Username ,Password FROM AdminUser WHERE Username='" & Logintxt.Text & "' AND Password='" & Passwordtxt.Text & "'"
cmd = New OleDbCommand(sql, con)
con.Open()
Dim dr As OleDbDataReader = cmd.ExecuteReader
Try
If dr.Read = False Then
MessageBox.Show("Authentication failed...")
Me.Show()
Else
MessageBox.Show("Login successfully...")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
con.Close()
End Sub
End Class