SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    vi
    Posts
    213
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation ASP SQL Query Wrong

    I am getting the error message

    Microsoft VBScript compilation (0x800A0409)
    Unterminated string constant



    Here is my Query, It is slight incorrect: HELP.

    newest_sql = "SELECT TOP 5 CatID, ContentID, DateAdded, Title, FeaturedLabel, NewestLabel FROM Content, ContentTypes Where Content.ContentTypeID = ContentTypes.ContentTypeID
    AND (((Content.Display)=1) AND ((ContentTypes.ContentTypeId)=4))
    ORDER BY DateAdded DESC"

  2. #2
    SitePoint Zealot trekmp's Avatar
    Join Date
    Dec 2005
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is this how is looks in your code, what I mean is it spead over these number of lines or it it just one long line as you may have press enter at the end of Where or something like that.

    Break it down

    Code:
    newest_sql="SELECT TOP 5 CatID, ContentID, DateAdded, Title, FeaturedLabel, NewestLabel FROM Content, ContentTypes "
    newest_sql=newest_sql & "WHERE Content.ContentTypeID=ContentTypes.ContentTypeID"
    newest_sql=newest_sql & " AND (((Content.Display)=1) AND ((ContentTypes.ContentTypeId)=4))"
    newest_sql=newest_sql & " ORDER BY DateAdded DESC"
    See if that helps
    Why do we exist? What is our purpose?
    >H2O Developments
    >USS Endeavour
    >Hosted@Servage

  3. #3
    SitePoint Enthusiast Northern Star's Avatar
    Join Date
    Aug 2006
    Location
    Cheshire, UK
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Another good tip is trying out your SQL in something like MS Access.
    "If it ain't broken, don't fix it!"
    ----
    Northern Star - Web design, stategy & development.

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Northern Star
    Another good tip is trying out your SQL in something like MS Access.
    that's an excellent tip, without the "in something like MS Access" part

    try the query in the same database you plan to run it on
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Enthusiast Northern Star's Avatar
    Join Date
    Aug 2006
    Location
    Cheshire, UK
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937
    that's an excellent tip, without the "in something like MS Access" part

    try the query in the same database you plan to run it on
    "If it ain't broken, don't fix it!"
    ----
    Northern Star - Web design, stategy & development.


Bookmarks

Posting Permissions

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