Hi
I encountered this problem.
this kind of expression doesn't always work properly:
query1: TMyQuery;
datecomponent: (3rd party component);
query1.parambyname('start_date').value := datecomponent.date;
I solved using:
query1.parambyname('start_date').asdate := datecomponent.date;
but I have a lot of code already written to fix and in some other case i don't know in advance if the param that i will pass to my query is a date or something else, so i must use ".value"
date parambyname
-
AndreyZ
Hello,
If you want to use the Value property, your third-party components (the datecomponent.date property) have to return dates as TDateTime. If they don't do it, please write about this problem to developers of your third-party components. Also, you can solve this problem in the way you have already found, by using the AsDate property instead of Value. Or you can explicitly cast datecomponent.date to TDateTime, for example:
If you want to use the Value property, your third-party components (the datecomponent.date property) have to return dates as TDateTime. If they don't do it, please write about this problem to developers of your third-party components. Also, you can solve this problem in the way you have already found, by using the AsDate property instead of Value. Or you can explicitly cast datecomponent.date to TDateTime, for example:
Code: Select all
query1.parambyname('start_date').value := TDateTime(datecomponent.date);-
andrea.m86
- Posts: 25
- Joined: Thu 26 May 2011 10:36
-
AndreyZ