Results 1 to 4 of 4

Thread: TrueIncorrect syntax near '-'.

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2011
    Posts
    1

    TrueIncorrect syntax near '-'.

    <%
    set conn = CreateObject("ADODB.Connection")
    conn.open strConnection
    sql = sql="Select t.hotels_id,t.roomtype_id, t.startdate, t.enddate, t.capacity, count(t.room_no) as total_room from h_room t where t.hotels_id=" &request("id")&" and t.capacity="&request("capacity")&"and (('" & request("startdate") & "' Between t.startdate And t.enddate)) and (('" & DateAdd("d",-1,request("closingdate")) & "' Between t.startdate And t.enddate)) and not exists (SELECT DISTINCT b.room_id FROM h_bookinfo a,h_room_booked b WHERE a.bookinfo_id=(b.bookinfo_id) and hotels_id="&request("id")&" and b.room_id=t.room_id and ((manual_booking='"&true&"' or status='"&true&"') or (manual_booking='"&true&"' and status='"&true&"')) and (('" & request("startdate") & "' Between checkin_date And checkout_date Or checkin_date between '" & request("startdate") & "' and '" & DateAdd("d",-1,request("closingdate")) & "') Or ('" & DateAdd("d",-1,request("closingdate")) & "' Between checkin_date And checkout_date Or checkout_date between '" & request("startdate") & "' and '" &DateAdd("d",-1,request("closingdate")) & "') ))group by t.hotels_id,t.roomtype_id,t.capacity,t.startdate,t.enddate"
    on error resume next
    conn.execute(sql)
    if err.number <> 0 then
    response.write(sql)
    if conn.errors.count > 0 then
    for each e in conn.errors
    response.write e.description & "<br>"
    next
    end if
    response.end
    end if

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: TrueIncorrect syntax near '-'.

    <?asp

    If you.HaveErrors Then
    threadpost = New Message
    threadpost.coherently = True
    threadpost.askquestion = True
    threadpost.Description = "Clear message"
    threadpost.Post(ToVBForums)
    End If

    If threadpost.style = clear Then
    threadpost.WillGetAnswers = True
    You.Rejoice()
    Else
    threadpost.WillGetAnswers = False
    threadpost.Replies = New threapost(style.NonSensical, "Remove Eels from Hovercraft")
    End if



    -tg
    Last edited by techgnome; Feb 2nd, 2011 at 11:52 AM.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: TrueIncorrect syntax near '-'.

    Quote Originally Posted by techgnome View Post
    ... threadpost.Replies = New threapost(style.NonSensical, "Remove Eels from Hovercraft")-tg
    Cute
    The OP may not get it, but if he looks in your signature links, maybe he will
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Re: TrueIncorrect syntax near '-'.

    What's the value stored in the variable sql? If you could post that, the error would be more obvious to spot.

    <Sigh> and please remember we are geeks/nerds who can't read English. We are better at reading code.

    .
    Last edited by honeybee; Feb 3rd, 2011 at 12:23 AM. Reason: tg, you missed the closing tag!
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

Posting Permissions

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



Click Here to Expand Forum to Full Width