If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > problem with sql query and quotes?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-20-04, 16:01
jimwarrenus jimwarrenus is offline
Registered User
 
Join Date: Jan 2004
Posts: 2
problem with sql query and quotes?

outside of asp i can run this query ok---

Select * from TMSCUST where ID = '5'

(in the sql table - sql server 2000 - ID is type int...)

but when i try to run it in my asp page, i get this error:

Syntax error converting the varchar value '5, ' to a column of data type int.

i think it might be a quotation mark issue?, but cant figure out anything that works......

asp statement:
strSQLu = "UPDATE TMSCUST SET billtofirstname = 'strFirstname', billtolastname = 'strLastname', source = 'strSource', billtostate = 'strState' " & _
"WHERE ID = '" & intID & "' "
Reply With Quote
  #2 (permalink)  
Old 01-20-04, 16:21
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
"WHERE ID = " & CInt(intID)
Reply With Quote
  #3 (permalink)  
Old 01-20-04, 17:04
jimwarrenus jimwarrenus is offline
Registered User
 
Join Date: Jan 2004
Posts: 2
Quote:
Originally posted by gyuan
"WHERE ID = " & CInt(intID)

that got it.....thanks much!
Reply With Quote
  #4 (permalink)  
Old 02-03-04, 04:21
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Yes in ASP this doesn't work for a number field because of the unneeded single quotes:
Select * from TMSCUST where ID = '5'

But this would work:
Select * from TMSCUST where ID = 5
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On