Posts

Showing posts with the label NativeClient

FireDAC Date Handling - FireDAC Date Mystery Part II

FireDAC Date Handling - FireDAC Date Mystery Part II As it turns out, the mystery was not fully solved. After adding map rules (see old post) to FireDAC for how to handle dtTime and dtDate, I removed the old ADO special case handling and just did Result := FieldByName(FieldName).AsDateTime; Which worked well - or - so I thought.  I had done all my testing on machines that had the SQL Server Native Client installed, and it showed no problems. But - when I ran on a machine without SQLNCLI installed, the date format issue reared it's ugly head again. So - this is the "final" workaround which so far appears to handle every date/time format that I have tossed at it. function TPSDRecordset.GetAsDateTime(const FieldName: string): TDateTime; var   F: TField;   s: String; begin     F := FieldByName(FieldName);     try     case F.DataType of       ftDateTime: Result := F.AsDateTime;       ftTime: Result := StrToTime(F.AsString);       ftDate: Result := StrToDate(F.AsString);       ...