Solved

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

Posted on 2013-05-23
1
600 Views
Last Modified: 2013-05-25
Hi everyone. I'm not at all talented with asp, so I'd really appreciate any help.

I am getting this error after i convert my MS ACCESS db to Mysql.  (in ms access works fine).

-------------------------
Microsoft OLE DB Provider for ODBC Drivers erro '80040e14'

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 'UNION (SELECT mensalidades.tipo_pagto, mensalidades.data_cheque, mensalidades.em' at line 1

http://localhost/finance/financeMfac/includes/lado01.asp,  line36
--------------------------
lado01.txt
0
Comment
Question by:artmx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 39194542
>>...and cdate(data_cheque)=cdate("&formatdatetime(now,2)&")
cdate() is not a mysql built-in function, so your queries will not work.  Use the STR_TO_DATE() function instead:
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_str-to-date

You will also need to refer to the DATE_FORMAT() section to look at the valid format specifiers:
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format

Let's say that in the table in question the "data_cheque" field has "7/6/2012".  Depending where you live, that may be interpreted as "July 6, 2012" OR "7th of June 2012".  The STR_TO_DATE() function needs the format parameter so that there wouldn't be any  confusion.

The format parameter to STR_TO_DATE(), "tells" mysql what part of your field value is the month, which part is the day of the month, and which part is the year.  The most popular/common format specifiers are explained below:


If the month is stored:
without leading zeros use %c
with leading zeros use %m

If the day of the month is stored:
without leading zeros use %e
with leading zeros use %d

If the year is stored:
with two digits use %y
with four digits use %Y


Assuming the value above is "July 6, 2012", the way to rewrite the above condition would be:
>>...and STR_TO_DATE(data_cheque,'%c/%d/%Y')=Now()

Notice that I got rid of cdate("&formatdatetime(now,2)&") since what you are doing is comparing data_cheque against the current time.  MySQL has a built-in function named "Now()" that will give you the current time.  So you can compare against it directly.

What if your date was stored as "07/06/2012" (notice the leading zeros).  In that case you would need:
>>...and STR_TO_DATE(data_cheque,'%m/%e/%Y')=Now()
0

Featured Post

Webinar: MariaDB® Server 10.2: The Complete Guide

Join Percona’s Chief Evangelist, Colin Charles as he presents MariaDB Server 10.2: The Complete Guide on Tuesday, June 27, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question