954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.

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

jaz854
Newbie Poster
9 posts since Jun 2007
Reputation Points: 13
Solved Threads: 0
 

Refer this thread

arjunsasidharan
Practically a Posting Shark
826 posts since Aug 2006
Reputation Points: 347
Solved Threads: 13
 

thanks

jaz854
Newbie Poster
9 posts since Jun 2007
Reputation Points: 13
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You