p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP 3.0 (http://p2p.wrox.com/forumdisplay.php?f=27)
-   -   just a question (http://p2p.wrox.com/showthread.php?t=14360)

gmoney060 June 17th, 2004 11:02 PM

just a question
 
i keep getting an error with this line of code:

tdcdelete.Open "Select * from news_messages where number=" & Request.Form("dates"), objconn,1,2

the error is:

Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'number='.

If you know what is wrong if you could email me that would be awsome at scoremaster25@msn.com or just respond to this post

THanks alot


om_prakash June 17th, 2004 11:33 PM

I think you are not getting the values in Request.Form("dates").

what Request.Form("dates") returns number or date?



Om Prakash

gmoney060 June 18th, 2004 12:10 AM

<%
        tdcVIEWdates=""
        Do While NOT tdcGETnews.EOF
        tdcVIEWdates=tdcVIEWdates & "<option value=" & tdcGETnews("number") & ">" & tdcGETnews("tdcopendate") & " <---> " & tdcGETnews("tdcclosedate") & "</option>"
        tdcGETnews.MoveNext
        Loop
        Set tdcGETnews = nothing
      %>
                  <b> </b> <br>

      <select size="8" name="dates" onDblClick="submit()"><%=tdcVIEWdates %></select> <br>
      <input type="submit" value="View" name="View"></p>
      <%If NOT isEmpty(Request.Form("dates")) Then
        Set tdcGETnews = Server.CreateObject("ADODB.RecordSet")
        tdcGETnews.Open "Select * from news_messages Where number=" + Request.Form("dates"),ObjConn,1,2
        If Not tdcGETnews.EOF Then
       %>


om_prakash June 18th, 2004 12:45 AM

modify
tdcGETnews.Open "Select * from news_messages Where number=" + Request.Form("dates"),ObjConn,1,2

to
tdcGETnews.Open "Select * from news_messages Where number=" & Request.Form("dates"),ObjConn,1,2


Om Prakash

gmoney060 June 18th, 2004 01:45 AM

still did not work


Imar June 18th, 2004 01:50 AM

I think number is a reserved word (the datatype for columns holding a number).
Change it to something like MyNumber, or enclose it in brackets:

Select * from news_messages where [number]

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: And So Is Love by Kate Bush (Track 2 from the album: The Red Shoes) What's This?

gmoney060 June 18th, 2004 02:05 AM

still does not work :(

I have been working on this error for like 2 hours now


Imar June 18th, 2004 02:10 AM

I think you're still passing an invalid SQL statement. Make the following change to your code, and then post the outcome of the Response.Write statement to this list:
Code:

Dim SQL
SQL = "Select * from news_messages Where [number] = " & Request.Form("dates")
Response.Write("SQL is " & SQL)
Response.End
tdcGETnews.Open SQL,ObjConn,1,2

I am beginning to suspect that Request.Form("dates") does not have a value.....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Rocket's Tail by Kate Bush (Track 9 from the album: The Sensual World) What's This?

gmoney060 June 18th, 2004 02:20 AM

first i want to let you know that that instead of 'number' now i am using tdcnumber and i did change that before i entered this script into my page.

This is what i get "SQL is Select * from news_messages Where tdcnumber ="


Imar June 18th, 2004 02:35 AM

Right, just what I thought. You're not getting a valid value from Request.Form("dates")

Where does Request.Form("dates") come from? From another page? Are you sure the field is called dates and contains a valid value?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: miDijunkies by Atari Teenage Riot (Track 6 from the album: Delete Yourself) What's This?


All times are GMT -4. The time now is 03:55 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.