MSSQL: Again, try to use some universal date/time format, by injecting a "T" between the date and the time portion. This time with a TRegExpr instead of a TDateTime object. See http://www.heidisql.com/forum.php?t=18441

This commit is contained in:
Ansgar Becker
2015-05-30 14:11:22 +00:00
parent d7415144c1
commit a2018b421f

View File

@@ -3944,10 +3944,24 @@ end;
function TDBConnection.GetDateTimeValue(Input: String; Datatype: TDBDatatypeIndex): String;
var
rx: TRegExpr;
begin
// Return date/time string value as expected by server
// Not sure why there was a conversion required in earlier versions.
Result := Input;
case Parameters.NetTypeGroup of
ngMSSQL: begin
rx := TRegExpr.Create;
rx.Expression := '^(\d+\-\d+\-\d+)\s(\d+\:.+)$';
Result := Input;
if rx.Exec(Input) then begin
// Inject "T" between date and time, for MSSQL. See http://www.heidisql.com/forum.php?t=18441
Result := rx.Match[1] + 'T' + rx.Match[2];
end;
rx.Free;
end;
else
Result := Input;
end;
end;