Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I have an error Data type mismatch in criteria expression when I run the application. Below are my codes.

 

Private Shared mdbPath As String = Application.StartupPath & "\Scholarship.mdb"

Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mdbPath
Dim strSQL As String
Dim rdrEdu As OleDbDataReader
Dim cn As New OleDbConnection(strConn)

cn.Open()
strSQL = "SELECT SSN, Status, HghSchoolGPA, ACT, SAT," & _
      "TotalCredits, GPALstSemester, GPACumulative, Rank " & _
       "FROM Education WHERE Education.SSN=" & "'" & intSSN & "'"

Dim cmdSQL As New OleDbCommand(strSQL, cn)

Try
rdrEdu = cmdSQL.ExecuteReader
  Catch dbException As System.Data.OleDb.OleDbException
MessageBox.Show(dbException.Message)
End Try

 

Please help.

 

Many thanks in advance.

 

Chong

Edited by Robby
Posted

Thanks for trying to help me.

 

Yes, the Education.SSN is a number. I did remove the quote around intSSN and here's the error I get:

 

No value given for one or more required parameters.

 

Thanks!

 

Chong

Posted

Thanks for helping me out. I'm greatly appreciated. Actually I found out that I never did call the rdr.Read in my code. Currenly I have been using this:

 

While rdr.Read

schlrHolder = rdr("SSN")

End While

 

But I wasn't sure if this most efficient and best way to do it.

 

Chong

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...