|
 |
access_asp thread: Syntax Error
Message #1 by "Michael Lumunsad" <mlumunsad@h...> on Tue, 5 Nov 2002 17:57:01
|
|
I'm not sure what is wrong with the syntax of this SQL statement in my
page.
sql = "UPDATE Make Set Make.Make='"&Name&"', URL='"&URL&"' WHERE ID="&ID
I'm not sure if the &ID is correct because I get this error: "Syntax error
in query expression 'ID=%=ID%>'."
I've tried several different variations in syntax but I still get an
error. Thanks
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 6 Nov 2002 11:24:55 +1100
|
|
Do this:
<%
sql = "...(all your existing code here)..."
Response.Write(sql)
Response.End
objConn.Execute(sql)
%>
so that you can see exactly what you are trying to send to the database. If
you still can't work out the problem, please post the output of the
Response.Write() statement to the list.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Michael Lumunsad" <mlumunsad@h...>
Subject: [access_asp] Syntax Error
: I'm not sure what is wrong with the syntax of this SQL statement in my
: page.
:
: sql = "UPDATE Make Set Make.Make='"&Name&"', URL='"&URL&"' WHERE ID="&ID
:
: I'm not sure if the &ID is correct because I get this error: "Syntax error
: in query expression 'ID=%=ID%>'."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "Michael Lumunsad" <mlumunsad@h...> on Wed, 6 Nov 2002 18:39:31
|
|
I did that and it just spurts out the SQL statement. I went over it and
noticed some other bugs, but now it comes down just to the SQL statement.
<html>
<head>
<title>Update Records</title>
</head>
<body bgcolor="#FFFFF">
<center>
<%
ID = request.form("ID")
Make = request.form("Make")
URL = request.form("URL")
set conn=server.createobject("adodb.connection")
conn.open "unify"
sql = "UPDATE Make SET Make.Make = '"&Make&"', Make.URL = '"&URL&"'"
sql = sql & "WHERE Make.[PKMake] =" &ID
set rs = conn.execute(sql)
If err.number>0 then
response.write "VBScript Errors Occured:" & "<P>"
response.write "Error Number=" & err.number & "<P>"
response.write "Error Descr.=" & err.description & "<P>"
response.write "Help Context=" & err.helpcontext & "<P>"
response.write "Help Path=" & err.helppath & "<P>"
response.write "Native Error=" & err.nativeerror & "<P>"
response.write "Source=" & err.source & "<P>"
response.write "SQLState=" & err.sqlstate & "<P>"
end if
IF conn.errors.count > 0 then
response.write "Database Errors Occurred" & "<P>"
response.write SQLstmt & "<P>"
for counter=0 to conn.errors.count
response.write "Error #" & conn.errors(counter).number
&"<P>"
response.write "Error desc. ->" & conn.errors
(counter).description & "<P>"
next
else
response.write "<font face='arial' size=4>"
response.write "<br><br> The record has been updated."
response.write "</b></font>"
end if
Conn.Close
Set Conn=nothing
%>
</center>
</body>
</html>
And this is the error I get...
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in query
expression 'Make.[PKMake] =%=ID%>'.
/ci/sample2-3.asp, line 37
> Do this:
<%
sql = "...(all your existing code here)..."
Response.Write(sql)
Response.End
objConn.Execute(sql)
%>
so that you can see exactly what you are trying to send to the database. If
you still can't work out the problem, please post the output of the
Response.Write() statement to the list.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Michael Lumunsad" <mlumunsad@h...>
Subject: [access_asp] Syntax Error
: I'm not sure what is wrong with the syntax of this SQL statement in my
: page.
:
: sql = "UPDATE Make Set Make.Make='"&Name&"', URL='"&URL&"' WHERE ID="&ID
:
: I'm not sure if the &ID is correct because I get this error: "Syntax
error
: in query expression 'ID=%=ID%>'."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #4 by "Michael Lumunsad" <mlumunsad@h...> on Wed, 6 Nov 2002 19:07:04
|
|
Disregard this question...I already figured it out. Thanks.
> I did that and it just spurts out the SQL statement. I went over it and
n> oticed some other bugs, but now it comes down just to the SQL statement.
>
<> html>
<> head>
<> title>Update Records</title>
<> /head>
<> body bgcolor="#FFFFF">
<> center>
<> %
I> D = request.form("ID")
M> ake = request.form("Make")
U> RL = request.form("URL")
> set conn=server.createobject("adodb.connection")
c> onn.open "unify"
> sql = "UPDATE Make SET Make.Make = '"&Make&"', Make.URL = '"&URL&"'"
s> ql = sql & "WHERE Make.[PKMake] =" &ID
> set rs = conn.execute(sql)
> If err.number>0 then
> response.write "VBScript Errors Occured:" & "<P>"
> response.write "Error Number=" & err.number & "<P>"
> response.write "Error Descr.=" & err.description & "<P>"
> response.write "Help Context=" & err.helpcontext & "<P>"
> response.write "Help Path=" & err.helppath & "<P>"
> response.write "Native Error=" & err.nativeerror & "<P>"
> response.write "Source=" & err.source & "<P>"
> response.write "SQLState=" & err.sqlstate & "<P>"
>
> end if
>
I> F conn.errors.count > 0 then
> response.write "Database Errors Occurred" & "<P>"
> response.write SQLstmt & "<P>"
> for counter=0 to conn.errors.count
> response.write "Error #" & conn.errors(counter).number
&> "<P>"
> response.write "Error desc. ->" & conn.errors
(> counter).description & "<P>"
> next
e> lse
> response.write "<font face='arial' size=4>"
> response.write "<br><br> The record has been updated."
> response.write "</b></font>"
e> nd if
C> onn.Close
> Set Conn=nothing
%> >
<> /center>
<> /body>
<> /html>
> And this is the error I get...
> Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
> [Microsoft][ODBC Microsoft Access Driver] Syntax error in query
e> xpression 'Make.[PKMake] =%=ID%>'.
> /ci/sample2-3.asp, line 37
>
>
>
>
>
> > Do this:
> <%
s> ql = "...(all your existing code here)..."
R> esponse.Write(sql)
R> esponse.End
> objConn.Execute(sql)
%> >
> so that you can see exactly what you are trying to send to the database.
If
y> ou still can't work out the problem, please post the output of the
R> esponse.Write() statement to the list.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
F> rom: "Michael Lumunsad" <mlumunsad@h...>
S> ubject: [access_asp] Syntax Error
>
:> I'm not sure what is wrong with the syntax of this SQL statement in my
:> page.
:>
:> sql = "UPDATE Make Set Make.Make='"&Name&"', URL='"&URL&"' WHERE
ID="&ID
:>
:> I'm not sure if the &ID is correct because I get this error: "Syntax
e> rror
:> in query expression 'ID=%=ID%>'."
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #5 by "Ken Schaefer" <ken@a...> on Thu, 7 Nov 2002 12:43:13 +1100
|
|
So post the SQL statement! There is something wrong with the SQL statement,
that is why you are getting an error when you try to Execute it (ie when you
send it to the database for processing). We need to be able to see what you
are sending to the database!
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Michael Lumunsad" <mlumunsad@h...>
Subject: [access_asp] Re: Syntax Error
: I did that and it just spurts out the SQL statement. I went over it and
: noticed some other bugs, but now it comes down just to the SQL statement.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #6 by "Charles Mabbott" <aa8vs@m...> on Thu, 07 Nov 2002 11:18:11 -0500
|
|
It looks to me like the '&' or '"' are not balenced in the area
of the error if I am counting lines correctly
Regards,
Chuck
"Whoever said the pen is mightier than the
sword obviously never encountered automatic
weapons."
http://68.43.100.7:81/aa8vs
>From: "Michael Lumunsad" <mlumunsad@h...>
>Reply-To: "Access ASP" <access_asp@p...>
>To: "Access ASP" <access_asp@p...>
>Subject: [access_asp] Re: Syntax Error
>Date: Wed, 6 Nov 2002 18:39:31
>
>I did that and it just spurts out the SQL statement. I went over it and
>noticed some other bugs, but now it comes down just to the SQL statement.
>
>
><html>
><head>
><title>Update Records</title>
></head>
><body bgcolor="#FFFFF">
><center>
><%
>ID = request.form("ID")
>Make = request.form("Make")
>URL = request.form("URL")
>
>set conn=server.createobject("adodb.connection")
>conn.open "unify"
>
>sql = "UPDATE Make SET Make.Make = '"&Make&"', Make.URL = '"&URL&"'"
>sql = sql & "WHERE Make.[PKMake] =" &ID
>
>set rs = conn.execute(sql)
>
>If err.number>0 then
> response.write "VBScript Errors Occured:" & "<P>"
> response.write "Error Number=" & err.number & "<P>"
> response.write "Error Descr.=" & err.description & "<P>"
> response.write "Help Context=" & err.helpcontext & "<P>"
> response.write "Help Path=" & err.helppath & "<P>"
> response.write "Native Error=" & err.nativeerror & "<P>"
> response.write "Source=" & err.source & "<P>"
> response.write "SQLState=" & err.sqlstate & "<P>"
>
> end if
>
>IF conn.errors.count > 0 then
> response.write "Database Errors Occurred" & "<P>"
> response.write SQLstmt & "<P>"
> for counter=0 to conn.errors.count
> response.write "Error #" & conn.errors(counter).number
>&"<P>"
> response.write "Error desc. ->" & conn.errors
>(counter).description & "<P>"
> next
>else
> response.write "<font face='arial' size=4>"
> response.write "<br><br> The record has been updated."
> response.write "</b></font>"
>end if
>Conn.Close
> Set Conn=nothing
>%>
></center>
></body>
></html>
>
>And this is the error I get...
>
>Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
>
>[Microsoft][ODBC Microsoft Access Driver] Syntax error in query
>expression 'Make.[PKMake] =%=ID%>'.
>
>/ci/sample2-3.asp, line 37
>
>
>
>
>
>
>
>
>
>
>
> > Do this:
>
><%
>sql = "...(all your existing code here)..."
>Response.Write(sql)
>Response.End
>
>objConn.Execute(sql)
>%>
>
>so that you can see exactly what you are trying to send to the database. If
>you still can't work out the problem, please post the output of the
>Response.Write() statement to the list.
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>From: "Michael Lumunsad" <mlumunsad@h...>
>Subject: [access_asp] Syntax Error
>
>
>: I'm not sure what is wrong with the syntax of this SQL statement in my
>: page.
>:
>: sql = "UPDATE Make Set Make.Make='"&Name&"', URL='"&URL&"' WHERE ID="&ID
>:
>: I'm not sure if the &ID is correct because I get this error: "Syntax
>error
>: in query expression 'ID=%=ID%>'."
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
|
|
 |