800A0401: Expected End of Statement

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default 800A0401: Expected End of Statement

    I am trying to get this code going but always the following error
    message:

    Error Type:
    Microsoft VBScript compilation (0x800A0401)
    Expected end of statement
    /hbgary/webdev/functions/functions.asp, line 367, column 64
    rs = "SELECT Body.G1, Body.G2, Body.content FROM Body Where G1="1" And
    G2="1""


    Here's my code:

    <%Sub Get_MainBody()
    set cn = Server.CreateObject("ADODB.Connection")
    set rs = Server.CreateObject("ADODB.Recordset")
    cn.Open "DSN=Webdata"
    rs = "SELECT Body.G1, Body.G2, Body.content FROM Body Where G1="1"
    And G2="1""
    If not rs.EOF then
    Response.Write rs("content")
    End If
    rs.Close
    cn.Close
    Set rs=nothing%>

    Can anybody point on where I did wrong?

    Thanks,
    P. Rifai

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Primadona Rifai Guest

  2. Similar Questions and Discussions

    1. Expected end of statement
      Hi all, This will be my 1st post on here! i am trying to view a list of files within a folder on my server drive using this bit of code. <%...
    2. The DREADED Expected end of statement
      Microsoft VBScript compilation error '800a0401' Can someone please look at my code and tell me what the deal is? I am stumped. Expected end of...
    3. Expected end of statement
      Try this instead provider=Microsoft.Jet.oledb.4.0;Data Source=c:\testapp\asp_test.mdb; User ID=('admin'); Password=("")
    4. Expected end of statement
      Can you post the EXACT error you're getting?
    5. Expected end of statement problem
      Having a nightmare problem with this and would appreciate any and all help. The situation is I want to move from a webform and format the user...
  3. #2

    Default Re: 800A0401: Expected End of Statement

    You're trying to stick " in the middle of a string. The " terminates the
    string though. If your G1 and G2 are text types of data, delimit with '.
    If they are numeric, do not delimit. IE

    rs = "SELECT Body.G1, Body.G2, Body.Content FROM Body WHERE G1='1' AND
    G2='1'"

    Notice that that is just a string. And a string starts with a " and ends
    with a ". There cannot be a " in the middle of your string. If you need a
    " in the middle of string, you put "" to indicate a " character. Either
    that or you concatenate chr(34).

    Ray at work


    "Primadona Rifai" <primadona.rifai@verizon.net> wrote in message
    news:%230Xp3hSiDHA.1688@TK2MSFTNGP10.phx.gbl...
    > I am trying to get this code going but always the following error
    > message:
    >
    > Error Type:
    > Microsoft VBScript compilation (0x800A0401)
    > Expected end of statement
    > /hbgary/webdev/functions/functions.asp, line 367, column 64
    > rs = "SELECT Body.G1, Body.G2, Body.content FROM Body Where G1="1" And
    > G2="1""
    >
    >
    > Here's my code:
    >
    > <%Sub Get_MainBody()
    > set cn = Server.CreateObject("ADODB.Connection")
    > set rs = Server.CreateObject("ADODB.Recordset")
    > cn.Open "DSN=Webdata"
    > rs = "SELECT Body.G1, Body.G2, Body.content FROM Body Where G1="1"
    > And G2="1""
    > If not rs.EOF then
    > Response.Write rs("content")
    > End If
    > rs.Close
    > cn.Close
    > Set rs=nothing%>
    >
    > Can anybody point on where I did wrong?
    >
    > Thanks,
    > P. Rifai
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Ray at Guest

  4. #3

    Default Re: 800A0401: Expected End of Statement

    Thanks, I missed that in a big way.

    P. Rifai

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Primadona Rifai Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139