Hi

I am a new beginner to VB.Net and I am trying to link an MSACCESS database that has a security table - login and password, but I have tried in vain to make it work. I always get the same message when I enter the userID and password 'Data trype mismatch in criteria expression'. Below is the code that I am using for my program. The AccountNo is a number data type format, while the passoword is in text.

Please, can someone provide some help.

Thanks in advance.


Public Class Form2
Inherits System.Windows.Forms.Form

# " Windows Form Designer generated code "



Dim str As String = "Provider = Microsoft.jet.OLEDB.4.0;Data Source =C:\Documents and Settings\...bin\Customer Tables and Transactions.mdb"
Dim conn As New OleDb.OleDbConnection(Str)




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


Dim cmd As New OleDb.OleDbCommand("select * from [Table 1: Security Table] where AccountNo='" + txtUserID.Text + "'", conn)
conn.Open()
Try
Dim rdr As OleDb.OleDbDataReader = cmd.ExecuteReader
If rdr.Read Then
Dim p As String = rdr(2)
If txtPassword.Text = p Then
Me.Close()
Else
MsgBox("Invalid Password!!")
txtPassword.Text = ""
txtPassword.Focus()
End If
Else
MsgBox("Invalid Username!!Try Again...")
txtUserID.Text = ""
txtPassword.Text = ""
txtUserID.Focus()
End If
conn.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub


End Class