Thanks Dwi for the tip, but unfortunately this solution is possible only in
applications which connect only to MySQL and I am already using it in those
applications but now I need to connect to MySQL or to MS Access (or to other DB
engine) with one query using only different connection string (and different
ODBC drivers). And thus I must set query parameters to their correct data types
and ODBC driver should do the conversions. And that is what is not working. I
will probably fill a bug report and will see.
Dusan
----- Original Message -----
From: Dwi Putra L
To: Dušan Pavlica
Sent: Friday, August 05, 2005 6:34 AM
Subject: Re: Problem with datetime values and MyODBC driver
Dušan Pavlica wrote:
Hello,
I'm working in C++ Builder 6.0 and I'm trying to create application which could
connect through ADO components to different databases using ODBC drivers.
If I create TADOQuery object which has datetime parametr and I fill this
parametr with valid datetime value then I can see in MYSQL's query log that
only date portion is used. But if I use same query object to connect to MS
Access then data in MS Access are OK.
Win XP, MyODBC 3.51.11, MySQL 4.1.9
Does anybody have any idea how to solve this problem?
Thanks in advance
Dusan Pavlica
I use delphi 7 and I have same problem with you
MySQL save and search datetime data as string.
My solution is to change datetime data into string
with format : 2005-08-05 (year-month-day)
--------------------------------------------------
var
str_year, str_month, str_day, str_date : string;
year, month, day : word;
DecodeDate(Now,year,month,day);
str_year := inttostr(year);
str_month := inttostr(month);
if Length(str_month) < 2 then
str_month := '0' + str_month;
str_day := inttostr(day);
if Length(str_day) < 2 then
str_day := '0' + str_day;
str_date := str_year + '-' + str_month + '-' + str_day;
-------------------------------------------------------
The same thing when I want to conduct a query,
which using date as parameters. I change certain
date into string.
_dwi.