I have encountered a new bug with the recent XHarbour ( released along with FWH ) TOleAuto class. The Dates written and read are different by 1 millisecond and hence date equality comparisons are going wrong. ( I confirm that this was working perfectly in the version I used six months back ). This is the problem with Excel, Access, or any RDBS accessed through ADO.
For example, if the data stored in the table ( or Excel sheet ) is 12th Aug 2009, the value read is 12th Aug 2009 PLUS one millisecond. Here is a test program:
The equality comparison returns false. In earlier versions this was working perfectly.
I noticed this when I was rebuilding a large project. All those modules which depended or date comparisons are going haywire. An easy workaround to compare DTOC instead of dates can be recommended, but it is not practically possible to search through a large software and replace.
Has anyone noticed this problem and any news of fixing this bug ?
For example, if the data stored in the table ( or Excel sheet ) is 12th Aug 2009, the value read is 12th Aug 2009 PLUS one millisecond. Here is a test program:
#include "fivewin.ch"
function Main()
local oExcel, oBook, oSheet
local dWrite, dRead
SET DATE ITALIAN
SET CENTURY ON
oExcel := CreateObject( "Excel.Application" )
oBook := oExcel:WorkBooks:Add()
oSheet := oExcel:ActiveSheet
dWrite := STOD( "20090812" )
oSheet:Cells( 1, 1 ):Value := dWrite
dRead := oSheet:Cells( 1, 1 ):Value
msginfo( "Written : Read" + CRLF + ;
"DTOC " + DTOC( dWrite ) + " : " + DTOC( dRead ) + CRLF + ;
"TTOC " + TTOC( dWrite ) + " : " + TTOC( dRead ) + CRLF + ;
"TTOS " + TTOS( dWrite ) + " : " + TTOS( dRead ), ;
If( dWrite == dRead, "EQUAL", "NOT EQUAL" ) )
oBook:Close()
return nilThe equality comparison returns false. In earlier versions this was working perfectly.
I noticed this when I was rebuilding a large project. All those modules which depended or date comparisons are going haywire. An easy workaround to compare DTOC instead of dates can be recommended, but it is not practically possible to search through a large software and replace.
Has anyone noticed this problem and any news of fixing this bug ?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India