Ask a Question related to Macromedia ColdFusion, Design and Development.
-
middletree #1
syntax error
I posted a question or two on this recently, and posts have been helpful.
However, I have a new problem, and don't know what to do.
To recap. Simple page, this page is what gets
shown when the previous page, which contains a form, is submitted using
Post. First thing I want to do is insert a row into the database, called
Shape, and the table in question is called Personal.
First, the code:
strFirstName = Replace(Trim(Request.Form("FirstName")),"'","''")
strLastName = Replace(Trim(Request.Form("LastName")),"'","''")
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Inetpub\wwwroot\Grace\Shape.mdb;User Id=admin;Password=;"
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnection
objConnection.Open
strSQL = "INSERT INTO Personal(FirstName,LastName) VALUES
('"&strFirstName&"','"&strLastName&"')"
Set rs = Server.CreateObject( "ADODB.Recordset" )
rs.Open strSQL, objConnection,
Set rs = objConnection.Execute( sql )
objConnection.Close
rs.Close
Set rs = Nothing
----------------------------------
I was getting another error, but the advice was to allow IUSR to have proper
permissions,. which I did. Now, i get this error:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/grace/shapethankyou.asp, line 152, column 30
rs.Open strSQL, objConnection,
-----------------------------^
middletree Guest
-
Help on Syntax error please
I'm new to MySQL. Sorry for asking for some probably very basic help. :( The following code is from a Dump of a php forums database (openBB... -
Syntax error?
Hi, I'm developing an ASP.NET web application with MySql 5. I have a little problem: if i create a stored procedure like this one: CREATE... -
error : syntax error at or near $1 for over select rows
This is the error i am getting when calling select * from cas_reset_qi_changedate('CAS','2003-02-03' ERROR: syntax error at or near "$1" at... -
syntax error ???
Hi, on login.php , we can see that : (...) $sql = "SELECT Login FROM logins WHERE Login='$fusername'"; $result = mysql_query($sql) or... -
SQL Syntax Error
Having some problems with my SQL statement syntax: Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression... -
Ray at #2
Re: syntax error
The error is pointing right to the issue, and that is that you have a
trailing comma that shouldn't be there. But, really, you have a couple of
lines of code that shouldn't be there. Remove these lines from your code
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open, strSQL, objConnection, <--that comma, btw
Those lines are unnecessary. After removing them, delete this line
Set rs = objConnection.Execute( sql ) ''wouldn't this have been strSQL?
And replace it with
objConnection.Execute strSQL
There is no need to create an RS when doing an insert.
Ray at work
--
Will trade ASP help for SQL Server help
"middletree" <middletree@htomail.com> wrote in message
news:%23EHqXr1cDHA.1728@TK2MSFTNGP09.phx.gbl...proper> I posted a question or two on this recently, and posts have been helpful.
> However, I have a new problem, and don't know what to do.
>
> To recap. Simple page, this page is what gets
> shown when the previous page, which contains a form, is submitted using
> Post. First thing I want to do is insert a row into the database, called
> Shape, and the table in question is called Personal.
> First, the code:
>
> strFirstName = Replace(Trim(Request.Form("FirstName")),"'","''")
> strLastName = Replace(Trim(Request.Form("LastName")),"'","''")
>
> strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=C:\Inetpub\wwwroot\Grace\Shape.mdb;User Id=admin;Password=;"
>
> Set objConnection = Server.CreateObject("ADODB.Connection")
> objConnection.ConnectionString = strConnection
> objConnection.Open
>
> strSQL = "INSERT INTO Personal(FirstName,LastName) VALUES
> ('"&strFirstName&"','"&strLastName&"')"
> Set rs = Server.CreateObject( "ADODB.Recordset" )
> rs.Open strSQL, objConnection,
>
> Set rs = objConnection.Execute( sql )
> objConnection.Close
>
> rs.Close
> Set rs = Nothing
> ----------------------------------
> I was getting another error, but the advice was to allow IUSR to have> permissions,. which I did. Now, i get this error:
>
> Microsoft VBScript compilation (0x800A03EA)
> Syntax error
> /grace/shapethankyou.asp, line 152, column 30
> rs.Open strSQL, objConnection,
> -----------------------------^
>
>
>
>
>
Ray at Guest
-
Bob Barrows #3
Re: syntax error
Ray at <%=sLocation%> wrote:
To be completely correct, I would recommend this:> And replace it with
> objConnection.Execute strSQL
objConnection.Execute strSQL,,129
Bob Barrows Guest
-
middletree #4
Re: syntax error
Makes sense when you say it.
thanks
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:uwFvpU2cDHA.2416@TK2MSFTNGP10.phx.gbl...helpful.> The error is pointing right to the issue, and that is that you have a
> trailing comma that shouldn't be there. But, really, you have a couple of
> lines of code that shouldn't be there. Remove these lines from your code
>
> Set rs = Server.CreateObject("ADODB.Recordset")
> rs.Open, strSQL, objConnection, <--that comma, btw
>
> Those lines are unnecessary. After removing them, delete this line
> Set rs = objConnection.Execute( sql ) ''wouldn't this have been strSQL?
>
> And replace it with
> objConnection.Execute strSQL
>
>
> There is no need to create an RS when doing an insert.
>
> Ray at work
>
> --
> Will trade ASP help for SQL Server help
>
>
> "middletree" <middletree@htomail.com> wrote in message
> news:%23EHqXr1cDHA.1728@TK2MSFTNGP09.phx.gbl...> > I posted a question or two on this recently, and posts have been> proper> > However, I have a new problem, and don't know what to do.
> >
> > To recap. Simple page, this page is what gets
> > shown when the previous page, which contains a form, is submitted using
> > Post. First thing I want to do is insert a row into the database, called
> > Shape, and the table in question is called Personal.
> > First, the code:
> >
> > strFirstName = Replace(Trim(Request.Form("FirstName")),"'","''")
> > strLastName = Replace(Trim(Request.Form("LastName")),"'","''")
> >
> > strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data
> > Source=C:\Inetpub\wwwroot\Grace\Shape.mdb;User Id=admin;Password=;"
> >
> > Set objConnection = Server.CreateObject("ADODB.Connection")
> > objConnection.ConnectionString = strConnection
> > objConnection.Open
> >
> > strSQL = "INSERT INTO Personal(FirstName,LastName) VALUES
> > ('"&strFirstName&"','"&strLastName&"')"
> > Set rs = Server.CreateObject( "ADODB.Recordset" )
> > rs.Open strSQL, objConnection,
> >
> > Set rs = objConnection.Execute( sql )
> > objConnection.Close
> >
> > rs.Close
> > Set rs = Nothing
> > ----------------------------------
> > I was getting another error, but the advice was to allow IUSR to have>> > permissions,. which I did. Now, i get this error:
> >
> > Microsoft VBScript compilation (0x800A03EA)
> > Syntax error
> > /grace/shapethankyou.asp, line 152, column 30
> > rs.Open strSQL, objConnection,
> > -----------------------------^
> >
> >
> >
> >
> >
>
middletree Guest
-
middletree #5
Re: syntax error
thanks for clarifying
"Bob Barrows" <reb_01501@yahoo.com> wrote in message
news:OfTLXC7cDHA.3448@TK2MSFTNGP11.phx.gbl...> Ray at <%=sLocation%> wrote:>> > And replace it with
> > objConnection.Execute strSQL
> To be completely correct, I would recommend this:
> objConnection.Execute strSQL,,129
>
>
middletree Guest
-
maizie #6
Syntax error
I am a newbie. What EXACTLY do these error messages mean so I can know where
to start to fix the problem? 'Syntax error (missing operator) in query
expression...' '....OWNERACCESS OPTION' And I have a general question. Why
does it take the MM site so long to load? Maizie
maizie Guest
-
paross1 #7
Re: Syntax error
Can't tell what the problem is without seeing any of the offending code.
paross1 Guest
-
maizie #8
Re: Syntax error
Two tables, one with company names and contacts related to another table with
states. They are both part of a master page that lists internships with links
to PDFs with more info and links to company which drills down to a detail page.
Everything on the page works except the drilldown to the company detail. Hope
it makes sense. SELECT internships.ID, internships.company,
internships.contact_name, internships.contact_title, internships.contact_phone,
internships.contact_fax, internships.contact_email,
internships.contact_address, internships.contact_city, internships.contact_zip,
internships.contact_web, contact_state.contact_state_ID,
contact_state.contact_state 21 : FROM internships, contact_state 22 : WHERE ID
= #URL.recordID# 23 : AND internships.contact_state_ID =
contact_state.contact_state_ID 24 : ORDER BY internships.company
maizie Guest
-
maizie #9
Re: Syntax error
So sorry for the bother. I just found the problem. Another newbie mistake. I apologize for taking your time.
Maizie
maizie Guest
-
Christo #10
Syntax Error
I am attempting to draw records based on street name and number information but
cannot seem to get the syntax of the query correct. The error is; ODBC Error
Code = 37000 (Syntax error or access violation) [Microsoft][ODBC Microsoft
Access Driver] Syntax error (missing operator) in query expression
'Street_Number = 1000 and StreetNm = CENTRE LINE'. The error occurred while
processing an element with a general identifier of (CFQUERY), occupying
document position (28:2) to (28:66). The query is; <cfquery
name='ClientQuery' datasource='CountyGIS' dbtype='odbc'> SELECT * FROM
Recycle Where Street_Number = #Street_Number# and StreetNm = #StreetNm#
</cfquery> The StreetNm (street name) is drawn from the DB, passed along to
the next page where the user manually puts in their Street_Number (street
number) which then should return matching record(s) from the DB. The error
shows the correct street name and number...but that is as far as it goes.
Thanks in advance!
Christo Guest
-
paross1 #11
Re: Syntax Error
Since #StreetNm# is text, it should be enclosed within single quotes as in and
StreetNm = '#StreetNm#'. Also, if Street_Number is also a text/char/varchar
column in the database, #Street_Number# would also be enclosed in quotes as
well.
Phil
paross1 Guest
-
jared.pohl@gmail.com #12
Syntax Error
Hi guys..
When I try and run the following code it says that there is a missing
operator..
SELECT
curr.portfolio_code,
curr.date,
(curr.gross_index-mo1.gross_index)/mo1.gross_index AS 1MONTH_RETURN,
(curr.gross_index-mo1.gross_index)/mo1.gross_index AS 3MONTH_RETURN
FROM portfolio_performance AS curr
LEFT OUTER JOIN portfolio_performance AS mo1
ON curr.date =
dateserial(year(dateadd('d',-1,dateserial(Year([mo1].date),
MONTH([mo1].date)+2, 1))),
month(dateadd('d',-1,dateserial(Year([mo1].date), MONTH([mo1].date)+2,
1))),day(dateadd('d',-1,dateserial(Year([mo1].date),MONTH([mo1].date)+2,
1))))
LEFT OUTER JOIN portfolio_performance AS mo3
ON curr.date =
dateserial(year(dateadd('d',-1,dateserial(Year([mo3].date),
MONTH([mo3].date)+4, 1))),
month(dateadd('d',-1,dateserial(Year([mo3].date), MONTH([mo3].date)+4,
1))),day(dateadd('d',-1,dateserial(Year([mo3].date),MONTH([mo3].date)+4,
1))))
;
However, when I run the same code, minus the second left outer join it
works perfectly..
SELECT
curr.portfolio_code,
curr.date,
(curr.gross_index-mo1.gross_index)/mo1.gross_index AS 1MONTH_RETURN
FROM portfolio_performance AS curr
LEFT OUTER JOIN portfolio_performance AS mo1
ON curr.date =
dateserial(year(dateadd('d',-1,dateserial(Year([mo1].date),
MONTH([mo1].date)+2, 1))),
month(dateadd('d',-1,dateserial(Year([mo1].date), MONTH([mo1].date)+2,
1))),day(dateadd('d',-1,dateserial(Year([mo1].date),MONTH([mo1].date)+2,
1))));
Any help would be appreciated.. im sure its only something minor!
jared.pohl@gmail.com Guest



Reply With Quote

