Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    2

    Unanswered: 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 & "' "

  2. #2
    Join Date
    Dec 2003
    Posts
    454
    "WHERE ID = " & CInt(intID)

  3. #3
    Join Date
    Jan 2004
    Posts
    2
    Originally posted by gyuan
    "WHERE ID = " & CInt(intID)

    that got it.....thanks much!

  4. #4
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •