473,395 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problems with UPDATE

Hi,

I am trying to create a simple ASP web counter for my site, but seem
to have an error somewhere ???
I am connecting to a MySQL server (works fine)

hit-marker = Varchar
hit_date = Date
hit-browser = Varchar
<%

marker = 1

browser = Request.ServerVariables("http_user_agent")

hitdate = date()
yy = Year(hitdate)
mm = Month(hitdate)
dd = Day(hitdate)
S_date = yy & "/" & mm & "/" & dd

Set adoDataConn = Server.CreateObject("ADODB.Connection")
adoDataConn.Open conn_string

uSQL = "INSERT INTO Webwiz (hit-marker, hit_date, hit-browser) VALUES
('" & marker & "'," & S_date & ",'" & browser & "');"
set RS = adoDataConn.Execute(uSQL)

%>

I keep getting the following error:

----------------------------------------------------------------

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

[MySQL][ODBC 3.51 Driver][mysqld-4.1.22-standard]You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '-marker, hit_date,
hit-browser) VALUES ('1',2007/6/5,'Mozilla/5.0 (Windows; U; W' at line
1

/hitwise.asp, line 20

________________________________________

What am I doing wrong ?
Any advise would be a great help :-)

Thanks in advance

David

Jun 5 '07 #1
2 1758
David wrote:
Hi,

I am trying to create a simple ASP web counter for my site, but seem
to have an error somewhere ???
I am connecting to a MySQL server (works fine)

hit-marker = Varchar
hit_date = Date
hit-browser = Varchar
<%

marker = 1

browser = Request.ServerVariables("http_user_agent")

hitdate = date()
yy = Year(hitdate)
mm = Month(hitdate)
dd = Day(hitdate)
S_date = yy & "/" & mm & "/" & dd

Set adoDataConn = Server.CreateObject("ADODB.Connection")
adoDataConn.Open conn_string

uSQL = "INSERT INTO Webwiz (hit-marker, hit_date, hit-browser) VALUES
('" & marker & "'," & S_date & ",'" & browser & "');"
set RS = adoDataConn.Execute(uSQL)

%>

I keep getting the following error:

----------------------------------------------------------------

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

[MySQL][ODBC 3.51 Driver][mysqld-4.1.22-standard]You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '-marker, hit_date,
hit-browser) VALUES ('1',2007/6/5,'Mozilla/5.0 (Windows; U; W' at line
1

/hitwise.asp, line 20

________________________________________

What am I doing wrong ?
Any advise would be a great help :-)
I don't use MySQL, but I suspect you are passing the date incorrectly. To
the query parser 2006/6/5 looks like 2006 divided by 6 divided by 5, a
formula which is unlikely to correspond to a valid date value. Look up in
the MySQL documentation to see how date literals are supposed to be used in
sql statements. In SQL Server, they have to be delimited with apostrophes.

If that's not it, then I suspect the query parser may be getting confused by
the hyphens in the column names. Can you change the names of those columns?
If so, that would be my course of action. If not, then you will need to
delimit the column names to tell the parser to accept them as they are. In
SQL Server, I would use brackets [hit-marker] . Check the MySQL
documentation to verify what delimiters should be used for identifiers.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jun 5 '07 #2
Gazing into my crystal ball I observed "Bob Barrows [MVP]"
<re******@NOyahoo.SPAMcomwriting in
news:OM**************@TK2MSFTNGP02.phx.gbl:
David wrote:
>Hi,

I am trying to create a simple ASP web counter for my site, but seem
to have an error somewhere ???
I am connecting to a MySQL server (works fine)

hit-marker = Varchar
hit_date = Date
hit-browser = Varchar
<%

marker = 1

browser = Request.ServerVariables("http_user_agent")

hitdate = date()
yy = Year(hitdate)
mm = Month(hitdate)
dd = Day(hitdate)
S_date = yy & "/" & mm & "/" & dd

Set adoDataConn = Server.CreateObject("ADODB.Connection")
adoDataConn.Open conn_string

uSQL = "INSERT INTO Webwiz (hit-marker, hit_date, hit-browser) VALUES
('" & marker & "'," & S_date & ",'" & browser & "');"
set RS = adoDataConn.Execute(uSQL)

%>

I keep getting the following error:

----------------------------------------------------------------

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

[MySQL][ODBC 3.51 Driver][mysqld-4.1.22-standard]You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '-marker, hit_date,
hit-browser) VALUES ('1',2007/6/5,'Mozilla/5.0 (Windows; U; W' at
line 1

/hitwise.asp, line 20

________________________________________

What am I doing wrong ?
Any advise would be a great help :-)
I don't use MySQL, but I suspect you are passing the date incorrectly.
To the query parser 2006/6/5 looks like 2006 divided by 6 divided by
5, a formula which is unlikely to correspond to a valid date value.
Look up in the MySQL documentation to see how date literals are
supposed to be used in sql statements. In SQL Server, they have to be
delimited with apostrophes.
Dates in MySQL: 'MM-DD-YYYY'
>
If that's not it, then I suspect the query parser may be getting
confused by the hyphens in the column names. Can you change the names
of those columns? If so, that would be my course of action. If not,
then you will need to delimit the column names to tell the parser to
accept them as they are. In SQL Server, I would use brackets
[hit-marker] . Check the MySQL documentation to verify what delimiters
should be used for identifiers.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Jun 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: | last post by:
Hello, Sorry to ask what is probably a simple answer, but I am having problems updating a table/database from a PHP/ PHTML file. I can Read From the Table, I can Insert into Table/Database, But...
0
by: ccuthbert | last post by:
I have a MCMS 2002 site that we recently had several hotfixes installed. After installing the hotfixes, both AOL users and Earthlink users experience tha same problem, namely that intermittently...
3
by: daveland | last post by:
I am working on some JavaScript that dynamically adds rows to a table in response to a button click. A new row does appear on the screen when the button is clicked. However, that table to which a...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
0
by: ccuthbert | last post by:
I have a MCMS 2002 site that we recently had several hotfixes installed. After installing the hotfixes, both AOL users and Earthlink users experience tha same problem, namely that intermittently...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.