View Full Version : syntax error
pinkcat_02
03-12-2003, 05:03 PM
I have read the thread posted at the top about syntax error with single quotes but this was for a string that has ' in it.
But mine is an integer and it still gives the same error and I don't know what is wrong with it. any idea?
Here is my code:
m_sSourceID = Request("Event_No")
SQL = "SELECT Event_Picture FROM event WHERE Event_No =" & m_sSourceID
Morgoth
03-12-2003, 08:50 PM
This might be tricky for some people to understand, but lots of the time when you send information form one page to another, it turns all your information into strings.
NOW!
Depending on how large your "Event_No" is you will need to know what type of integer it is..
If your number is an Integer, a double, a long Integer, a single, etc...
I assume your "Event_No" is going to be an integer:
m_sSourceID = cInt(Request("Event_No"))
SQL = "SELECT Event_Picture FROM event WHERE Event_No =" & m_sSourceID
Converts your string into an integer, you can also do the other types: cLng() etc....
Morgoth
03-12-2003, 09:00 PM
Also, did you make a function called Request()?
What exactly are you requesting? A QueryString? a Form? A ServerVariable?
Roy Sinclair
03-12-2003, 10:10 PM
Originally posted by Morgoth
Also, did you make a function called Request()?
What exactly are you requesting? A QueryString? a Form? A ServerVariable?
Request used without a qualifier will check all the associated collections (form, querystring ...) at the cost of extra overhead and the risk of being short-circuited by a unexpected match in the "wrong" collection.
Morgoth
03-12-2003, 10:13 PM
Oh... I only used VB to check if Request was a function, and it wasn't so I assume he might of missed something there.
Roy Sinclair
03-12-2003, 10:39 PM
I've used that a few times. When I'm still developing a page that receives data from a form which is normally "post" but I want to just use the URL in the browser to vary the input I'll use the Request("formfield") format (usually to make sure my error handling works). I also try to make sure I change it to Request.Form("formfield") before it goes production.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.