Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

Date conversion issue when using OleDBDataReder

$
0
0

Hello All,

The current AX installation I am working on has a custom class built which reads an excel file using OleDBDataReader. Everything is pretty much working as expected with it, except there is a weird issue with a date field in the excel document.

 

In the class, we declare the trxDate variable to be a Date date type, we then use OleDBDataReader.get_Item() to set the trxDate variable to the proper field in excel.

 

Normally this works fine, but I have recieved a few files to import using this class where the date field has an apostrophe in front of the date (e.g. '10/31/2015). When this occours, AX throws an error that the "Error executing Code: Wrong Type of argument for the conversion function" at the line:

 

trxDate = OleDBDateReade.Get_Item(3);

 

 

However, the code continues to run and sets the trxDate variable to January first of the yeah 20xx where xx is the month value in the origional date.

 

So '10/31/2015 becomes 1/1/2010, '21/1/2011 becomes 1/1/2012, ect.

 

So my question is, how/why is AX taking the date value with an apostrophy in front of it and converting it totally different date?

 

 

Thank you,

 

Philo


Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>