943,945 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 1504
  • ASP RSS
Jun 24th, 2006
0

Help with asp datatype mismatch error

Expand Post »
I am doing a simple profile update webpage, I keep getting this error and can'y figure out how to fix it. I have included the code. The only field in my database that isn't a text field is my userid field which is an autoinumber field.

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.


Userid = Request.Form("Uidfield")

strSQL = "SELECT * FROM users WHERE Uid='"& Userid &"';"

Set results = cnnEXDB.Execute(strSQL)


Any help with this would be greatly appreciated.
Last edited by dave1323; Jun 24th, 2006 at 4:22 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dave1323 is offline Offline
3 posts
since Apr 2006
Jun 25th, 2006
0

Re: Help with asp error

by putting the single quotes around the it, you are making it text instead of a number. also you are leaving yourself open to a sql injection attack. you want this
ASP Syntax (Toggle Plain Text)
  1.  
  2. Userid = CInt(Request.Form("Uidfield"))
  3. 'By using CInt you prevent people from passing in inappropriate data
  4.  
  5. strSQL = "SELECT * FROM users WHERE Uid="& Userid &";"
  6.  
  7. Set results = cnnEXDB.Execute(strSQL)
Reputation Points: 14
Solved Threads: 19
Posting Pro in Training
campkev is offline Offline
484 posts
since Jul 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: ASP File Publish in PHP server
Next Thread in ASP Forum Timeline: ASP Scritp Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC