Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-05-23
1
Medium Priority
?
604 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

636 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