Skip to main content

GetFieldNames

procedure GetFieldNames(List: TStrings);

Example

procedure ReadFieldNames(const Data: TvxClientDataSet; const Names: TStringList);
begin
Data.GetFieldNames(Names);
end;

Usage

GetFieldNames replaces a supplied TStrings list with current field names or updated field-definition names.

  • Pass a caller-owned TStringList and free it in the owning scope.
  • Expect the target to be cleared.
  • Treat names as schema metadata, not trusted SQL fragments.

Additional Technical Info

GetFieldNames is declared by hidden ancestor TDataSet and is normally used through a visible descendant such as TvxClientDataSet. The caller owns the target list and must pass a live concrete TStrings descendant.

Source-backed behaviour

When current field components exist, the modified base calls List.SetStrings(FieldList); otherwise it calls FieldDefs.Update and then copies FieldDefList. SetStrings clears the target and copies names, so prior target contents are replaced rather than appended.

Updating field definitions can ask the concrete dataset/provider for metadata and can fail even without opening all record data. A nil target dereferences and raises.

FieldCount counts instantiated fields. FindField and FieldByName resolve a selected name.

Official RTL references

Created 2026-07-15