Get list of table fields

Posted in Databases

You may use FieldName property of TField class for each Field of your table. For example:

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
begin
  with Table1 do
  begin
    Active:=False;
    DataBaseName:=Edit1.Text;
    TableName:=Edit2.Text;
    Active:=True;
    Memo1.Clear;
    for i:=0 to FieldCount-1 do
      Memo1.Lines.Add(Fields[i].FieldName);
  end;
end;