Hello Guys,

I am getting this error message and I can't figure out why. can somebody please help. below is the code.

Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click

Dim sql = "SELECT Username,Password FROM Password WHERE Username = "" & txtUsername.Text & "" AND Password = "" & txtPassword.Text & " '"

cmd = New OleDbCommand(sql, conn)

conn.Open()

Dim dr As OleDbDataReader = cmd.ExecuteReader

Try
conn.Open()
Catch ex As Exception
MsgBox(ex.Message)

End Try
Try
If dr.Read = False Then
MessageBox.Show("Authentication Failed...")
Else
MessageBox.Show("Login Successful...")

End If
Catch ex As Exception
MsgBox(ex.Message)

If conn.State <> ConnectionState.Closed Then
conn.Close()

End If

Dim form As New mainfrm
form.Show()
End Try
End Sub

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.