I am a new user of MyDac. I tryed to use the following line (MySQL 5 / Delphi 7):
......
MyTableX.fieldbyname('AdateTimeField').asdatetime := Now;
and I get an error of imcompatible fields.
so I tryed:
......
MyQueryX.parambyname('AdateTimeField').asdatetime := Now;
and I get the same.
How can I move a DateTime value like Now to a MySQL field Datetime?
Using a trigger, the same field acceptssomething like Set ADateTimeFiled to curret_timestamp, but the field is defined as Datetime.
Thank you
Edison
problem with datetime field
If c_datetime is a field of DATETIME type, the following code should work:
Send us (evgeniyD*crlab*com) a complete small sample to demonstrate the problem if the tip above does not help. Also do not forget to include script to create and fill table(s).
Also supply us with the following information:
- Exact error message you get
- Exact version of Delphi, C++ Builder or Kylix you use
- 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
Code: Select all
MyQuery.Open;
MyQuery.Insert;
MyQuery.FieldByName('c_datetime').AsDateTime := Now;
MyQuery.Post;Also supply us with the following information:
- Exact error message you get
- Exact version of Delphi, C++ Builder or Kylix you use
- 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
-
Edison Garcia
- Posts: 29
- Joined: Sat 29 Jul 2006 01:52
DateTime problem
Thank you for your answer, but, as you can see in my original message, the line you sugest is exactly the line that I try to use, and more, I triyed to use also as a parambyname....as datetime := Now and get the same error.
Now I am not with the machine where I have MyDac installed, so I can not send all you ask ( I will do it at night), but I can give part of the information:
- Exact error message you get ( I wiil send later)
- Exact version of Delphi, C++ Builder or Kylix you use
Delphi 7 professional with updates installed
- Exact version of MyDAC. You can see it in About sheet of TMyConnection Editor
Probably the last one, since I had made the purchase and download less than 15 days ago;
- Exact version of MySQL server and MySQL client. You can see it in Info sheet of TMyConnection Editor
Version 5.024
I did not use any script to create the table. I use EMS mannager and create the table manually, but if you extract the metadata of the table you can see that the field is defined as DateTime. ( I wikk send it at night also)
Thank you
Edison
Now I am not with the machine where I have MyDac installed, so I can not send all you ask ( I will do it at night), but I can give part of the information:
- Exact error message you get ( I wiil send later)
- Exact version of Delphi, C++ Builder or Kylix you use
Delphi 7 professional with updates installed
- Exact version of MyDAC. You can see it in About sheet of TMyConnection Editor
Probably the last one, since I had made the purchase and download less than 15 days ago;
- Exact version of MySQL server and MySQL client. You can see it in Info sheet of TMyConnection Editor
Version 5.024
I did not use any script to create the table. I use EMS mannager and create the table manually, but if you extract the metadata of the table you can see that the field is defined as DateTime. ( I wikk send it at night also)
Thank you
Edison
-
Edison Garcia
- Posts: 29
- Joined: Sat 29 Jul 2006 01:52