query problem "missing operator"

Results 1 to 6 of 6

Thread: query problem "missing operator"

  1. #1
    Join Date
    Dec 1969
    Posts
    36

    Default query problem "missing operator"

    I am getting this error:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e14&#039 <BR><BR>[Microsoft][ODBC Microsoft Access 97 Driver] Syntax error (missing operator) in query expression &#039ID=&#039. <BR><BR>/dakota/info2.asp, line 23 <BR><BR><BR>With this script:<BR>&#060;%@ Language = VBscript %&#062;<BR>&#060;%<BR><BR>Dim ID<BR>Dim SQLDAKNAME<BR>Dim conndakname<BR>Dim dakname<BR><BR><BR>ID=Request.Querystring("ID")<BR ><BR>SQLDAKNAME="SELECT dakName FROM DakotaEnglish "<BR>SQLDAKNAME=SQLDAKNAME & "WHERE ID= " & ID<BR><BR>set conndakname = server.createobject("ADODB.Connection")<BR>conndak name.open "dakota"<BR>set dakname=conndakname.execute(SQLDAKNAME)<BR>%&#062; <BR><BR>Any suggestions?<BR><BR>Thanks,<BR><BR>Paula

  2. #2
    Join Date
    Dec 1969
    Posts
    553

    Default RE: query problem

    Since you are getting your value with request.querystring("ID"), I assume that you are calling this particular page with a page using a form with the &#039get&#039 method. If you are using a form with the &#039post&#039 method, you need to use request.form("ID"). Or, you can use request("ID") which will take care of both forms (we are using this method currently).<BR><BR>Hope this helps...

  3. #3
    Join Date
    Dec 1969
    Posts
    36

    Default RE: query problem

    thanks for the response Joe. But it seems that this line is the problem and changing the request method does not prevent the error --<BR><BR>SQLDAKNAME="SELECT dakName FROM DakotaEnglish "<BR>SQLDAKNAME=SQLDAKNAME & "WHERE ID= " & ID (According to <BR>the error report there is a "Syntax error (missing operator) in query expression &#039ID=&#039". <BR><BR>But what is missing? IS it something else I have missed in the<BR>script which proceeds it perhaps?<BR><BR>Please suggest if you can,<BR>Thanks<BR>Paula:)<BR>

  4. #4
    Join Date
    Dec 1969
    Posts
    613

    Default RE: query problem

    Try enclosing the variable in single quotes and or ending the statement with a semi colon.<BR><BR>"WHERE ID=&#039" & ID & "&#039 ;"


  5. #5
    Join Date
    Dec 1969
    Posts
    36

    Default RE: query problem

    Hey Scott<BR><BR>Thanks for the advice..I tried it but alas to no avail!:(<BR>Below is the whole code..maybe the mistake is further down..<BR>within the html perhaps..please take a second to have a look<BR><BR>The Error:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e14&#039 <BR>[Microsoft][ODBC Microsoft Access 97 Driver] Syntax error (missing operator) in query expression &#039ID=&#039. <BR>/dakota/info2.asp, line 23<BR><BR><BR>&#060;%@ Language = VBscript %&#062;<BR>&#060;%<BR><BR>Dim ID<BR>Dim SQLDAKNAME<BR>Dim conndakname<BR>Dim dakname<BR><BR>ID=Request("ID")<BR><BR>SQLDAKNAME= "SELECT dakName FROM DakotaEnglish "<BR>SQLDAKNAME=SQLDAKNAME & "WHERE ID= " & ID<BR><BR>set conndakname = server.createobject("ADODB.Connection")<BR>conndak name.open "dakota"<BR>(line 23)set dakname=conndakname.execute(SQLDAKNAME)<BR>%&#062; <BR>&#060;HTML&#062;<BR>&#060;HEAD&#062;<BR> &#060;TITLE&#062;&#060;/TITLE&#062;<BR>&#060;/HEAD&#062;<BR><BR><BR>&#060;BODY bgcolor="black" text="white"&#062;<BR>&#060;center&#062;<BR>&#060; table width="250"&#062;<BR> &#060;tr&#062;<BR> &#060;td&#062;<BR> &#060;font face="arial" size="6"&#062;&#060;%= dakname(0) %&#062; is the translation.<BR> &#060;p&#062;Which dialect do you want&#060;/font&#062;<BR> &#060;form action="last.asp" method="get"&#062;<BR> &#060;input type="Hidden" name="ID" value="&#060;%= ID %&#062;"&#062;<BR> <BR> &#060;% &#039Use and include to generate the dropdown list. %&#062;<BR> &#060;!--#include file="dakdown.inc"--&#062; *<BR> &#060;input type="Submit" value="enter" align="LEFT"&#062;<BR> &#060;/form&#062;<BR> &#060;/td&#062;<BR> &#060;/tr&#062;<BR>&#060;/table&#062;<BR> &#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;/table&#062;<BR><BR>&#060;p&#062;<BR>&#060;p&#062;< BR>&#060;/center&#062;<BR>&#060;/BODY&#062;<BR>&#060;/HTML&#062;<BR><BR>

  6. #6
    John Weeflaar Guest

    Default RE: query problem

    I&#039m not sure what you&#039re trying to do, but here is what I can see:<BR>Your ID variable is uninitialized (empty) on this line:<BR><BR>&#060;input type="Hidden" name="ID" value="&#060;%= ID %&#062;"&#062;<BR><BR>And so, the ID on the other page: ID=Request("ID")<BR>contains null. And it in turns generates an error when you use<BR>the SQL statement for a null ID.<BR><BR>You&#039ll need to create an event handler for your listbox if you want to assign a value to the Textbox when you select an item in the list.<BR>That should be in your "dakdown.inc" file.<BR><BR>John

Posting Permissions

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