Hi,
I am using DBF Uniprovider to read DBF database. I want to cast a Date field into a DateTime field to be able to read it using asDateTime function.
When I directly use the Date field without explicit conversion: works fine
SELECT a.date as newduedate FROM mytable a => ok (but it is not what I want)
When I explictly cast the Date field into DateTime : error "can't access to the field as DateTime"
SELECT CAST(a.date as datetime) as newduedate FROM mytable a => KO, not od DateTime type
I need to explicitly convert the field into DateTime because it will be the result of a CASE that I need to explicitly cast into DateTime for using asDateTime method.
If somebody can help me,
Thanks so much.
Impossible to cast a Date into Datetime (DBF Uniprovider)
-
- Posts: 2
- Joined: Wed 10 Oct 2018 08:43
Re: Impossible to cast a Date into Datetime (DBF Uniprovider)
In the latest release of UniDAC, we added a possibility to map fields to DateTime for TDBFUniprovider.
In order for the newduedate field from the specified SQL query to be mapped to DateTime, add the following mapping rule:
More details about Data Type Mapping in our online documentation: https://www.devart.com/unidac/docs/data ... apping.htm .
In order for the newduedate field from the specified SQL query to be mapped to DateTime, add the following mapping rule:
Code: Select all
UniQuery.DataTypeMap.AddFieldNameRule('newduedate', ftDatetime);
UniQuery.Open;
-
- Posts: 2
- Joined: Wed 10 Oct 2018 08:43
Re: Impossible to cast a Date into Datetime (DBF Uniprovider)
I have the last release of Unidac. I used the AddFieldNameRule method but it doesn't change anything.
newDueDate is not recognized as DateTime.
newDueDate is not recognized as DateTime.
Re: Impossible to cast a Date into Datetime (DBF Uniprovider)
We cannot reproduce this issue. Please compose a small test project for its demonstration. In the project, include all files of the mytable table (mytable.dbf + mytable.* memo and index files). Use the contact form at our website http://www.devart.com/company/contactform.html and send us the project.