Solved

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

Posted on 2013-05-23
1
597 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
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

790 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