Solved

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

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now