hi guys... i have an urgent problem please give an idea about it..


Question#1: I want to know the correct date syntax in query database using MySQL...
Question#2: I currenly using the MySQL connector/OBDC 3.51 is their any problem about it??


thxx in advance.... and ned asap reply...
thxxxxxxxxxxxx guyzzzzz..

Dani AI

Generated

— brief, practical roadmap that answers both parts of your question and ties back to earlier replies from and .

MySQL expects date/datetime values in ISO format and as SQL string literals (single quotes). Avoid Access-style date delimiters or locale-dependent text. When building a filter from two textboxes, pass real date values (or parameters) to the query instead of concatenating raw text. For example, a parameterized query approach (ODBC/JDBC prepared statement) looks like:

SELECT * FROM your_table
WHERE date_column BETWEEN ? AND ?;

If date_column is DATETIME and you want an inclusive end date, prefer an exclusive end bound on the next day to avoid time-component mistakes:

SELECT * FROM your_table
WHERE date_column >= ? AND date_column < ?;   -- set second = EndDate + INTERVAL 1 DAY

Troubleshooting the "access denied" error: read the exact error text (it usually includes 'user'@'host'). Verify the credentials by trying the same login with the mysql client. Confirm the account exists and has required privileges (SELECT User,Host FROM mysql.user; and use GRANT if needed). Example grant pattern:

GRANT SELECT ON dbname.* TO 'username'@'hostname' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

About Connector/ODBC 3.51: it is an older driver series. If problems persist, try a current connector version and ensure your connection string and ODBC DSN use the correct user/host and enable proper date handling. For authoritative details see MySQL date/time literals and Connector/ODBC documentation: Date and Time Literals and Connector/ODBC docs. Use parameterized queries and date-picker controls in the UI to avoid formatting bugs.

Recommended Answers

All 5 Replies

Please be more specific:
how do you want to use date syntax?

Please be more specific:
how do you want to use date syntax?

i want to use the date syntax in my related form and also to my reports. i want to use date as a filter condition on my database MySQL using the 2 txtbox that hold the date value. One txtbox hold the (starting date) and the another txtbox hold the (ending date value).

i have also problem with the "access denied error" that i think is a MySQL bug.

mySql Date Format is: Year-Month-Date

which is YYYY-MM-dd

Did you solve the problem?

SQL="SELECT * From Table Where DATE Between #" & Format$(Startdate, "YYYY-MM-dd") & " # and #" & Format$(Enddate, "YYYY-MM-dd") & " #"

Best Regards
Eng.Awny

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.