Solved

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

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

713 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