Problems with UPDATE

D

David

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
 
B

Bob Barrows [MVP]

David said:
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.
 
A

Adrienne Boswell

David said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top