I am using ODAC 9.7.26 for C++Builder 6.0 Professional Edition.
I have built an application which can connect either to Oracle or MSSQL, where there a table containing date and time values with milliseconds.
On the way to reduce the amount of necessary code I am casting TOraQuery and TADOQuery to TDataSet, which TFields have the TField::AsDateTime property.
Code: Select all
TSQLTimeStamp TimeStamp;
TDataSet *Consulta;
TOraQuery *OraQry;
TADOQuery *SqlQry_STO;
if( FServerSTO == "ORACLE" )
{ Consulta = OraQry ;}
if( FServerSTO == "SQLSERVER" )
{ Consulta = SqlQry_STO ;}
<cut>
TimeStamp = DateTimeToSQLTimeStamp(Consulta->FieldByName ( "E3TIMESTAMP")->AsDateTime) ;
DtHrE3TIMESTAMP = TDateTime( TimeStamp.Year, TimeStamp.Month, TimeStamp.Day) +
TDateTime( TimeStamp.Hour, TimeStamp.Minute, TimeStamp.Second, TimeStamp.Fractions);
Previously the application was written only for Oracle and I was using Field::AsSQLTimeStamp from TOraQuery and it was working fine, when I added the connection to MSSQL I had to change the code and I realise that TField::AsDateTime works differently for TOraQuery and TADOQuery, although both components answer the same for the TField::AsString property.
TOraQuery omits the milliseconds part on the AsDateTime property while TADOQuery do not.
I am stuck because I would not like to write different codes just to accommodate the behaviour of TOraQuery, which I in my humble opinion should include milliseconds when answering to TField::AsDateTime property.
Is there anything else i can do instead of writing different codes ?
Best regards.
Jayme Jeffman