Refresh throws an error when a fieldname contains a special character, like by ex. an Umlaut "äöü" (Yes I know this is bad practice, but I am working with an external Access-Database which contains such Fieldnames, and even Tablenames)
This is due, because DefineKeyFields only quotes Fieldnames containing " .-"
Code: Select all
function DefineKeyFields(Fields: TFields): string;
var
I: Integer;
Temp: string;
begin
Result := '';
for I := 0 to Fields.Count - 1 do
begin
if (Fields[I].FieldKind = fkData)
and not (Fields[I].DataType in [ftBlob, ftMemo, ftBytes {$IFDEF WITH_WIDEMEMO}, ftWideMemo{$ENDIF}]) then
begin
if Result <> '' then
Result := Result + ',';
Temp := Fields[I].FieldName;
if (ZFastCode.Pos(' ', Temp) > 0) or (ZFastCode.Pos('-', Temp) > 0) or (ZFastCode.Pos('.', Temp) > 0) then
Temp := '"' + Temp + '"';
Result := Result + Temp;
end;
end;
end;
Code: Select all
function DefineKeyFields(Fields: TFields): string;
var
I: Integer;
begin
Result := '';
for I := 0 to Fields.Count - 1 do
begin
if (Fields[I].FieldKind = fkData)
and not (Fields[I].DataType in [ftBlob, ftMemo, ftBytes {$IFDEF WITH_WIDEMEMO}, ftWideMemo{$ENDIF}]) then
begin
if Result <> '' then
Result := Result + ',';
Result := Result + '"' + Fields[I].FieldName+ '"';
end;
end;
end;