{
FieldCount, Fields, FieldName example
This example displays a message box with the names of all fields in a table.
}
procedure TForm1.Button2Click(Sender: TObject);
var
   i: Integer;
   Info: String;
begin
   Info := 'The fields of table ' + Table1.TableName + 
           ' are:'#13#10#13#10;
   for i := 0 to Table1.FieldCount - 1 do
      Info := Info + Table1.Fields[i].FieldName + #13#10;
  ShowMessage(Info);
end;
{
Cross-platform:
}
procedure TForm1.Button2Click(Sender: TObject);
var
   i: Integer;
   Info: String;
begin
  if SQLDataSet1.CommandType = ctTable then
  begin
    Info := 'The fields of table ' + SQLDataSet1.CommandText + 
           ' are:'#10#10;
    for i := 0 to SQLDataSet1.FieldCount - 1 do
      Info := Info + SQLDataSet1.Fields[i].FieldName + #10;
    ShowMessage(Info);
  end;
end; 
