Hi!
My problem:
I hva sql sentence SELECT DATE(:d) AS DATE , field1 FROM table WHERE ....
ParamByName('d').AsDate:=info_date.Date; //info_date is calendar
if param= 2006-11-12 ...and my result is 2006-11-13
WHY?
then I put my paremeter like this
ParamByName('d').AsString:=FormatdateTime('YYYY-MM-DD',info_date.Date);
..works fine...but on some other computer I get message
you have an error in your MYSQL syntax. Check the amnual that coresponds...to use near '('2006-11-13') AS DATE, field1 FROM...'
thanks!
AsDAteTime makes 1 plus day
Please send us (evgeniyD*crlab*com) a complete small sample to demonstrate the issue with the wrong date value, including script to create and fill table if it is required.
Also supply us following information
- Exact version of Delphi, C++ Builder or Kylix
- Exact version of MyDAC. You can see it in About sheet of TMyConnection Editor
- Exact version of MySQL server and MySQL client. You can see it in Info sheet of TMyConnection Editor
The error in the SQL syntax may be raised because of different date format used in different server instances. Try to check the date_format server variable.
Also supply us following information
- Exact version of Delphi, C++ Builder or Kylix
- Exact version of MyDAC. You can see it in About sheet of TMyConnection Editor
- Exact version of MySQL server and MySQL client. You can see it in Info sheet of TMyConnection Editor
The error in the SQL syntax may be raised because of different date format used in different server instances. Try to check the date_format server variable.
i find out the problem but I still don't know way
it works!
ParamByName('d').AsDateTime:=info_date.Date;
now date is ok but in other computer still error
you have an error in your MYSQL syntax. Check the amnual that coresponds...to use near '('2006-11-13 11:21:22') AS DATE, field1 FROM...'
on the other computer is MYSQL 4x
it works!
ParamByName('d').AsDateTime:=info_date.Date;
now date is ok but in other computer still error
you have an error in your MYSQL syntax. Check the amnual that coresponds...to use near '('2006-11-13 11:21:22') AS DATE, field1 FROM...'
on the other computer is MYSQL 4x
Thank you for your collaboration. We have reproduced the problem. It happened because TMonthCalendar adds current time to the Date value. MyDac performed rounding but not truncating the time part of a TDateTime value to convert it to a TDate value. So the day became incremented. Now this problem is fixed. This fix will be included in the next MyDAC build.