Forum Moderators: open

Message Too Old, No Replies

Syntax Error in ASP

I can't see what the syntax error is, pls help

         

cherry

3:09 pm on May 27, 2003 (gmt 0)

10+ Year Member



Hi Guys

Below is an error that I keep getting

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '¤'.

/content/drinks.asp, line 39

here is the code that is at line 39 and above

35if request("currentbrand") = "" then currentbrand = brands("id") else currentbrand = request("currentbrand")
36Set drinks = Server.CreateObject("ADODB.Recordset")
37sqlstmt1 = "SELECT * FROM drinktypes WHERE brandno = " 38& currentbrand
39drinks.Open sqlstmt1, db, 3, 3

here is the code at line 1

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file ="../connection.asp"-->
<%

I can't see where the syntax error would be....I hope you can help me and point me in the right direction.

Thanks for your help :-)

RainMaker

3:29 pm on May 27, 2003 (gmt 0)

10+ Year Member



In your Select statement for your query, I have always used
single quotes in a WHERE clause. although I don't know what datatype you are doing and stuff. I am guessing this is old ASP? I don't think that " " 38 is really syntax correct. I think you need an & or a + or whatever the concatenation is in VB ASP. If it's the Line number and currentbrand is a char datatype or maybe even a numerical, then I would suggest single quotes....that is all I can really think of to try. Hope I helped....just a little...hehe:-))

Staffa

3:52 pm on May 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I guess 35 etc.. are your line numbers, try this and copy the exact lay-out :

if request("currentbrand") = "" then currentbrand = brands("id")
else currentbrand = request("currentbrand")
end if

Set drinks = Server.CreateObject("ADODB.Recordset")
sqlstmt1 = "SELECT * FROM drinktypes WHERE brandno = " & currentbrand
drinks.Open sqlstmt1, db, 3, 3

Also, the term - request - is not used by itself. Depending where you need to get the ID from it could be Request.QueryString or Request.Form or such like.
Hope this helps

cherry

4:05 pm on May 27, 2003 (gmt 0)

10+ Year Member



Thanks for getting back to me so quickly :-)

I'm new to ASP and have to edit other people's code so sometimes things can get really bogged down for me. I'll try what you suggested and get back to you :-)

Thanks again guys