DataSetField.FieldCount得到其字段数;
Var
  I,J :Integer;
  D :TDBEdit;
begin
I := DataSetField.FieldCount;
for J := 0 to I - 1 do
begin
  D := TDBEdit.Create(Self);
  D.Parent := Form;
  D.Left :=..;
  D.Top :=..;
  D.Width := ..;
  D.Height :=..;
  D.DataSet := ..;
  D.DataField := ..;
  D.Name := ..//可要可不要;
end;

解决方案 »

  1.   

    不明白你为什么要这么做。我觉得你应该先吧数据库的表信息读入数据库,再考虑使用DBGRID等来表现。
      

  2.   

    我想,它所谓的动态生成就是在程序中动态的创建窗体;
    var
      ..
    begin
      ..create(application);
      ..showmodal/show;
    end;
    窗体上:
    MyStringList := TStringList.Create;
    try
      Session.GetTableNames('DBDEMOS', '*.db',False, False, MyStringList);
      ComboBox.Items = MyStringList;
    finally
      MyStringList.Free;
    end;
    然后在
    ComboBox.onchange
    begin
      ...
    end;