Help with asp error

Please support our ASP advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Apr 2006
Posts: 3
Reputation: dave1323 is an unknown quantity at this point 
Solved Threads: 0
dave1323 dave1323 is offline Offline
Newbie Poster

Help with asp datatype mismatch error

 
0
  #1
Jun 24th, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Help with asp error

 
0
  #2
Jun 25th, 2006
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
  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)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC